Exemple #1
0
 def get_config(self):
     config = {
         'ensemble_activation':
         tf.keras.activations.serialize(self.ensemble_activation),
         'use_ensemble_bias':
         self.use_ensemble_bias,
         'alpha_initializer':
         initializers.serialize(self.alpha_initializer),
         'gamma_initializer':
         initializers.serialize(self.gamma_initializer),
         'ensemble_bias_initializer':
         initializers.serialize(self.ensemble_bias_initializer),
         'alpha_regularizer':
         regularizers.serialize(self.alpha_regularizer),
         'gamma_regularizer':
         regularizers.serialize(self.gamma_regularizer),
         'ensemble_bias_regularizer':
         regularizers.serialize(self.ensemble_bias_regularizer),
         'alpha_constraint':
         constraints.serialize(self.alpha_constraint),
         'gamma_constraint':
         constraints.serialize(self.gamma_constraint),
         'ensemble_bias_constraint':
         constraints.serialize(self.ensemble_bias_constraint),
         'ensemble_size':
         self.ensemble_size,
     }
     new_config = super().get_config()
     new_config.update(config)
     return new_config
Exemple #2
0
 def get_config(self):
     config = {
         'activation': tf.keras.activations.serialize(self.activation),
         'use_bias': self.use_bias,
         'alpha_initializer':
         initializers.serialize(self.alpha_initializer),
         'gamma_initializer':
         initializers.serialize(self.gamma_initializer),
         'bias_initializer': initializers.serialize(self.bias_initializer),
         'alpha_regularizer':
         regularizers.serialize(self.alpha_regularizer),
         'gamma_regularizer':
         regularizers.serialize(self.gamma_regularizer),
         'bias_regularizer': regularizers.serialize(self.bias_regularizer),
         'alpha_constraint': constraints.serialize(self.alpha_constraint),
         'gamma_constraint': constraints.serialize(self.gamma_constraint),
         'bias_constraint': constraints.serialize(self.bias_constraint),
         'use_additive_perturbation': self.use_additive_perturbation,
         'ensemble_size': self.ensemble_size,
     }
     base_config = super().get_config()
     dense_config = self.dense.get_config()
     return dict(
         list(base_config.items()) + list(dense_config.items()) +
         list(config.items()))
Exemple #3
0
 def get_config(self):
   return {
       'mean_initializer': serialize(self.mean_initializer),
       'stddev_initializer': serialize(self.stddev_initializer),
       'mean_regularizer': regularizers.serialize(self.mean_regularizer),
       'stddev_regularizer': regularizers.serialize(self.stddev_regularizer),
       'mean_constraint': constraints.serialize(self.mean_constraint),
       'stddev_constraint': constraints.serialize(self.stddev_constraint),
       'seed': self.seed,
   }
Exemple #4
0
 def get_config(self):
   return {
       'loc_initializer': serialize(self.loc_initializer),
       'scale_initializer': serialize(self.scale_initializer),
       'loc_regularizer': regularizers.serialize(self.loc_regularizer),
       'scale_regularizer': regularizers.serialize(self.scale_regularizer),
       'loc_constraint': constraints.serialize(self.loc_constraint),
       'scale_constraint': constraints.serialize(self.scale_constraint),
       'seed': self.seed,
   }
Exemple #5
0
 def get_config(self):
     return {
         'num_components': self.num_components,
         'loc_initializer': serialize(self.loc_initializer),
         'loc_regularizer': regularizers.serialize(self.loc_regularizer),
         'loc_constraint': constraints.serialize(self.loc_constraint),
         'seed': self.seed,
     }
Exemple #6
0
 def get_config(self):
     config = {
         'units':
         self.units,
         'lambda_key_to_index':
         self.lambda_key_to_index,
         'rank':
         self.dense.rank,
         'ensemble_size':
         self.ensemble_size,
         'activation':
         tf.keras.activations.serialize(self.activation),
         'use_bias':
         self.use_bias,
         'alpha_initializer':
         initializers.serialize(self.alpha_initializer),
         'gamma_initializer':
         initializers.serialize(self.gamma_initializer),
         'kernel_initializer':
         initializers.serialize(self.dense.kernel_initializer),
         'bias_initializer':
         initializers.serialize(self.bias_initializer),
         'kernel_regularizer':
         regularizers.serialize(self.dense.kernel_regularizer),
         'bias_regularizer':
         regularizers.serialize(self.dense.bias_regularizer),
         'activity_regularizer':
         regularizers.serialize(self.activity_regularizer),
         'kernel_constraint':
         constraints.serialize(self.dense.kernel_constraint),
         'bias_constraint':
         constraints.serialize(self.dense.bias_constraint),
         'regularize_fast_weights':
         self.regularize_fast_weights,
         'fast_weights_eq_contraint':
         self.fast_weights_eq_contraint
     }
     new_config = super().get_config()
     new_config.update(config)
     return new_config
Exemple #7
0
 def get_config(self):
   config = {
       'ensemble_size': self.ensemble_size,
       'alpha_initializer': initializers.serialize(self.alpha_initializer),
       'gamma_initializer': initializers.serialize(self.gamma_initializer),
       'bias_initializer': initializers.serialize(self.bias_initializer),
       'bias_regularizer': regularizers.serialize(self.bias_regularizer),
       'bias_constraint': constraints.serialize(self.bias_constraint),
       'activation': tf.keras.activations.serialize(self.activation),
       'use_bias': self.use_bias,
   }
   new_config = super(DepthwiseConv2DBatchEnsemble, self).get_config()
   new_config.update(self.conv2d.get_config())
   new_config.update(config)
   return new_config
Exemple #8
0
 def get_config(self):
   """Returns the configuration for the layer."""
   config = {
       'units': self.units,
       'activation': tf.keras.activations.serialize(self.activation),
       'recurrent_activation': tf.keras.activations.serialize(
           self.recurrent_activation),
       'use_bias': self.use_bias,
       'alpha_initializer': initializers.serialize(self.alpha_initializer),
       'gamma_initializer': initializers.serialize(self.gamma_initializer),
       'kernel_initializer': initializers.serialize(
           self.kernel_initializer),
       'recurrent_alpha_initializer': initializers.serialize(
           self.recurrent_alpha_initializer),
       'recurrent_gamma_initializer': initializers.serialize(
           self.recurrent_gamma_initializer),
       'recurrent_initializer': initializers.serialize(
           self.recurrent_initializer),
       'bias_initializer': initializers.serialize(self.bias_initializer),
       'unit_forget_bias': self.unit_forget_bias,
       'alpha_regularizer': regularizers.serialize(self.alpha_regularizer),
       'gamma_regularizer': regularizers.serialize(self.gamma_regularizer),
       'kernel_regularizer': regularizers.serialize(
           self.kernel_regularizer),
       'recurrent_alpha_regularizer': regularizers.serialize(
           self.recurrent_alpha_regularizer),
       'recurrent_gamma_regularizer': regularizers.serialize(
           self.recurrent_gamma_regularizer),
       'recurrent_regularizer': regularizers.serialize(
           self.recurrent_regularizer),
       'bias_regularizer': regularizers.serialize(self.bias_regularizer),
       'alpha_constraint': constraints.serialize(self.alpha_constraint),
       'gamma_constraint': constraints.serialize(self.gamma_constraint),
       'kernel_constraint': constraints.serialize(self.kernel_constraint),
       'recurrent_alpha_constraint': constraints.serialize(
           self.recurrent_alpha_constraint),
       'recurrent_gamma_constraint': constraints.serialize(
           self.recurrent_gamma_constraint),
       'recurrent_constraint': constraints.serialize(
           self.recurrent_constraint),
       'bias_constraint': constraints.serialize(self.bias_constraint),
       'dropout': self.dropout,
       'recurrent_dropout': self.recurrent_dropout,
       'implementation': self.implementation,
       'use_additive_perturbation': self.use_additive_perturbation,
       'ensemble_size': self.ensemble_size,
   }
   base_config = super().get_config()
   return dict(list(base_config.items()) + list(config.items()))