Esempio n. 1
0
 def get_config(self):
     config = {
         'filters':
         self.filters,
         'kernel_size':
         self.kernel_size,
         'strides':
         self.strides,
         'padding':
         self.padding,
         'data_format':
         self.data_format,
         'activation':
         activations.serialize(self.activation),
         'use_bias':
         self.use_bias,
         'kernel_initializer':
         initializers.serialize(self.kernel_initializer),
         'bias_initializer':
         initializers.serialize(self.bias_initializer),
         'kernel_regularizer':
         regularizers.serialize(self.kernel_regularizer),
         'bias_regularizer':
         regularizers.serialize(self.bias_regularizer),
         'activity_regularizer':
         regularizers.serialize(self.activity_regularizer),
         'kernel_constraint':
         constraints.serialize(self.kernel_constraint),
         'bias_constraint':
         constraints.serialize(self.bias_constraint)
     }
     base_config = super(LocallyConnected2D, self).get_config()
     return dict(list(base_config.items()) + list(config.items()))
Esempio n. 2
0
 def get_config(self):
     config = {
         'units':
         self.units,
         'kernel_initializer':
         initializers.serialize(self.kernel_initializer),
         'recurrent_initializer':
         initializers.serialize(self.recurrent_initializer),
         'bias_initializer':
         initializers.serialize(self.bias_initializer),
         'unit_forget_bias':
         self.unit_forget_bias,
         'kernel_regularizer':
         regularizers.serialize(self.kernel_regularizer),
         'recurrent_regularizer':
         regularizers.serialize(self.recurrent_regularizer),
         'bias_regularizer':
         regularizers.serialize(self.bias_regularizer),
         'activity_regularizer':
         regularizers.serialize(self.activity_regularizer),
         'kernel_constraint':
         constraints.serialize(self.kernel_constraint),
         'recurrent_constraint':
         constraints.serialize(self.recurrent_constraint),
         'bias_constraint':
         constraints.serialize(self.bias_constraint)
     }
     base_config = super(CuDNNLSTM, self).get_config()
     return dict(list(base_config.items()) + list(config.items()))
Esempio n. 3
0
 def get_config(self):
     config = {
         'units':
         self.units,
         'activation':
         activations.serialize(self.activation),
         'use_bias':
         self.use_bias,
         'kernel_initializer':
         initializers.serialize(self.kernel_initializer),
         'bias_initializer':
         initializers.serialize(self.bias_initializer),
         'kernel_regularizer':
         regularizers.serialize(self.kernel_regularizer),
         'bias_regularizer':
         regularizers.serialize(self.bias_regularizer),
         'activity_regularizer':
         regularizers.serialize(self.activity_regularizer),
         'kernel_constraint':
         constraints.serialize(self.kernel_constraint),
         'bias_constraint':
         constraints.serialize(self.bias_constraint)
     }
     base_config = super(Dense, self).get_config()
     return dict(list(base_config.items()) + list(config.items()))
Esempio n. 4
0
 def get_config(self):
     config = {
         'axis':
         self.axis,
         'momentum':
         self.momentum,
         'epsilon':
         self.epsilon,
         'center':
         self.center,
         'scale':
         self.scale,
         'beta_initializer':
         initializers.serialize(self.beta_initializer),
         'gamma_initializer':
         initializers.serialize(self.gamma_initializer),
         'moving_mean_initializer':
         initializers.serialize(self.moving_mean_initializer),
         'moving_variance_initializer':
         initializers.serialize(self.moving_variance_initializer),
         'beta_regularizer':
         regularizers.serialize(self.beta_regularizer),
         'gamma_regularizer':
         regularizers.serialize(self.gamma_regularizer),
         'beta_constraint':
         constraints.serialize(self.beta_constraint),
         'gamma_constraint':
         constraints.serialize(self.gamma_constraint)
     }
     base_config = super(BatchNormalization, self).get_config()
     return dict(list(base_config.items()) + list(config.items()))
 def get_config(self):
   config = {'filters': self.filters,
             'kernel_size': self.kernel_size,
             'strides': self.strides,
             'padding': self.padding,
             'data_format': self.data_format,
             'dilation_rate': self.dilation_rate,
             'activation': activations.serialize(self.activation),
             'recurrent_activation': activations.serialize(
                 self.recurrent_activation),
             'use_bias': self.use_bias,
             'kernel_initializer': initializers.serialize(
                 self.kernel_initializer),
             'recurrent_initializer': initializers.serialize(
                 self.recurrent_initializer),
             'bias_initializer': initializers.serialize(self.bias_initializer),
             'unit_forget_bias': self.unit_forget_bias,
             'kernel_regularizer': regularizers.serialize(
                 self.kernel_regularizer),
             'recurrent_regularizer': regularizers.serialize(
                 self.recurrent_regularizer),
             'bias_regularizer': regularizers.serialize(self.bias_regularizer),
             'kernel_constraint': constraints.serialize(
                 self.kernel_constraint),
             'recurrent_constraint': constraints.serialize(
                 self.recurrent_constraint),
             'bias_constraint': constraints.serialize(self.bias_constraint),
             'dropout': self.dropout,
             'recurrent_dropout': self.recurrent_dropout}
   base_config = super(ConvLSTM2DCell, self).get_config()
   return dict(list(base_config.items()) + list(config.items()))
Esempio n. 6
0
 def get_config(self):
   config = {
       'units': self.units,
       'activation': activations.serialize(self.activation),
       'recurrent_activation':
           activations.serialize(self.recurrent_activation),
       'use_bias': self.use_bias,
       'kernel_initializer': initializers.serialize(self.kernel_initializer),
       'recurrent_initializer':
           initializers.serialize(self.recurrent_initializer),
       'bias_initializer': initializers.serialize(self.bias_initializer),
       'kernel_regularizer': regularizers.serialize(self.kernel_regularizer),
       'recurrent_regularizer':
           regularizers.serialize(self.recurrent_regularizer),
       'bias_regularizer': regularizers.serialize(self.bias_regularizer),
       'activity_regularizer':
           regularizers.serialize(self.activity_regularizer),
       'kernel_constraint': constraints.serialize(self.kernel_constraint),
       'recurrent_constraint':
           constraints.serialize(self.recurrent_constraint),
       'bias_constraint': constraints.serialize(self.bias_constraint),
       'dropout': self.dropout,
       'recurrent_dropout': self.recurrent_dropout
   }
   base_config = super(GRU, self).get_config()
   return dict(list(base_config.items()) + list(config.items()))
Esempio n. 7
0
 def get_config(self):
   config = {
       'axis': self.axis,
       'momentum': self.momentum,
       'epsilon': self.epsilon,
       'center': self.center,
       'scale': self.scale,
       'beta_initializer': initializers.serialize(self.beta_initializer),
       'gamma_initializer': initializers.serialize(self.gamma_initializer),
       'moving_mean_initializer':
           initializers.serialize(self.moving_mean_initializer),
       'moving_variance_initializer':
           initializers.serialize(self.moving_variance_initializer),
       'beta_regularizer': regularizers.serialize(self.beta_regularizer),
       'gamma_regularizer': regularizers.serialize(self.gamma_regularizer),
       'beta_constraint': constraints.serialize(self.beta_constraint),
       'gamma_constraint': constraints.serialize(self.gamma_constraint)
   }
   # Only add TensorFlow-specific parameters if they are set, so as to preserve
   # model compatibility with external Keras.
   if self.renorm:
     config['renorm'] = True
     config['renorm_clipping'] = self.renorm_clipping
     config['renorm_momentum'] = self.renorm_momentum
   if self.virtual_batch_size is not None:
     config['virtual_batch_size'] = self.virtual_batch_size
   # Note: adjustment is not serializable.
   if self.adjustment is not None:
     logging.warning('The `adjustment` function of this `BatchNormalization` '
                     'layer cannot be serialized and has been omitted from '
                     'the layer config. It will not be included when '
                     're-creating the layer from the saved config.')
   base_config = super(BatchNormalization, self).get_config()
   return dict(list(base_config.items()) + list(config.items()))
Esempio n. 8
0
 def get_config(self):
   config = {
       'filters':
           self.filters,
       'kernel_size':
           self.kernel_size,
       'strides':
           self.strides,
       'padding':
           self.padding,
       'data_format':
           self.data_format,
       'activation':
           activations.serialize(self.activation),
       'use_bias':
           self.use_bias,
       'kernel_initializer':
           initializers.serialize(self.kernel_initializer),
       'bias_initializer':
           initializers.serialize(self.bias_initializer),
       'kernel_regularizer':
           regularizers.serialize(self.kernel_regularizer),
       'bias_regularizer':
           regularizers.serialize(self.bias_regularizer),
       'activity_regularizer':
           regularizers.serialize(self.activity_regularizer),
       'kernel_constraint':
           constraints.serialize(self.kernel_constraint),
       'bias_constraint':
           constraints.serialize(self.bias_constraint)
   }
   base_config = super(LocallyConnected2D, self).get_config()
   return dict(list(base_config.items()) + list(config.items()))
 def get_config(self):
     config = {
         'filters':
         self.filters,
         'kernel_size':
         self.kernel_size,
         'strides':
         self.strides,
         'padding':
         self.padding,
         'data_format':
         self.data_format,
         'dilation_rate':
         self.dilation_rate,
         'activation':
         activations.serialize(self.activation),
         'recurrent_activation':
         activations.serialize(self.recurrent_activation),
         'use_bias':
         self.use_bias,
         'kernel_initializer':
         initializers.serialize(self.kernel_initializer),
         'recurrent_initializer':
         initializers.serialize(self.recurrent_initializer),
         'bias_initializer':
         initializers.serialize(self.bias_initializer),
         'unit_forget_bias':
         self.unit_forget_bias,
         'kernel_regularizer':
         regularizers.serialize(self.kernel_regularizer),
         'recurrent_regularizer':
         regularizers.serialize(self.recurrent_regularizer),
         'bias_regularizer':
         regularizers.serialize(self.bias_regularizer),
         'activity_regularizer':
         regularizers.serialize(self.activity_regularizer),
         'kernel_constraint':
         constraints.serialize(self.kernel_constraint),
         'recurrent_constraint':
         constraints.serialize(self.recurrent_constraint),
         'bias_constraint':
         constraints.serialize(self.bias_constraint),
         'dropout':
         self.dropout,
         'recurrent_dropout':
         self.recurrent_dropout
     }
     base_config = super(ConvLSTM2D, self).get_config()
     del base_config['cell']
     return dict(list(base_config.items()) + list(config.items()))
 def get_config(self):
   config = {
       'alpha_initializer': initializers.serialize(self.alpha_initializer),
       'alpha_regularizer': regularizers.serialize(self.alpha_regularizer),
       'alpha_constraint': constraints.serialize(self.alpha_constraint),
       'shared_axes': self.shared_axes
   }
   base_config = super(PReLU, self).get_config()
   return dict(list(base_config.items()) + list(config.items()))
 def get_config(self):
   config = {
       'alpha_initializer': initializers.serialize(self.alpha_initializer),
       'alpha_regularizer': regularizers.serialize(self.alpha_regularizer),
       'alpha_constraint': constraints.serialize(self.alpha_constraint),
       'shared_axes': self.shared_axes
   }
   base_config = super(PReLU, self).get_config()
   return dict(list(base_config.items()) + list(config.items()))
Esempio n. 12
0
 def get_config(self):
   config = {
       'axis': self.axis,
       'momentum': self.momentum,
       'epsilon': self.epsilon,
       'center': self.center,
       'scale': self.scale,
       'beta_initializer': initializers.serialize(self.beta_initializer),
       'gamma_initializer': initializers.serialize(self.gamma_initializer),
       'moving_mean_initializer':
           initializers.serialize(self.moving_mean_initializer),
       'moving_variance_initializer':
           initializers.serialize(self.moving_variance_initializer),
       'beta_regularizer': regularizers.serialize(self.beta_regularizer),
       'gamma_regularizer': regularizers.serialize(self.gamma_regularizer),
       'beta_constraint': constraints.serialize(self.beta_constraint),
       'gamma_constraint': constraints.serialize(self.gamma_constraint)
   }
   base_config = super(BatchNormalization, self).get_config()
   return dict(list(base_config.items()) + list(config.items()))
Esempio n. 13
0
 def get_config(self):
   config = {
       'units': self.units,
       'kernel_initializer': initializers.serialize(self.kernel_initializer),
       'recurrent_initializer':
           initializers.serialize(self.recurrent_initializer),
       'bias_initializer': initializers.serialize(self.bias_initializer),
       'kernel_regularizer': regularizers.serialize(self.kernel_regularizer),
       'recurrent_regularizer':
           regularizers.serialize(self.recurrent_regularizer),
       'bias_regularizer': regularizers.serialize(self.bias_regularizer),
       'activity_regularizer':
           regularizers.serialize(self.activity_regularizer),
       'kernel_constraint': constraints.serialize(self.kernel_constraint),
       'recurrent_constraint':
           constraints.serialize(self.recurrent_constraint),
       'bias_constraint': constraints.serialize(self.bias_constraint)
   }
   base_config = super(CuDNNGRU, self).get_config()
   return dict(list(base_config.items()) + list(config.items()))
Esempio n. 14
0
 def get_config(self):
     config = {
         'filters': self.filters,
         'kernel_size': self.kernel_size,
         'strides': self.strides,
         'padding': self.padding,
         'data_format': self.data_format,
         'dilation_rate': self.dilation_rate,
         'activation': activations.serialize(activations.get(self.activation)),
         'use_bias': self.use_bias,
         'kernel_initializer': initializers.serialize(initializers.get(self.kernel_initializer)),
         'bias_initializer': initializers.serialize(initializers.get(self.bias_initializer)),
         'kernel_regularizer': regularizers.serialize(regularizers.get(self.kernel_regularizer)),
         'bias_regularizer': regularizers.serialize(regularizers.get(self.bias_regularizer)),
         'activity_regularizer': regularizers.serialize(regularizers.get(self.activity_regularizer)),
         'kernel_constraint': constraints.serialize(constraints.get(self.kernel_constraint)),
         'bias_constraint': constraints.serialize(constraints.get(self.bias_constraint))
     }
     base_config = {"name": self.layername}
     return dict(list(base_config.items()) + list(config.items()))
Esempio n. 15
0
 def get_config(self):
     config = {
         'input_dim':
         self.input_dim,
         'output_dim':
         self.output_dim,
         'embeddings_initializer':
         initializers.serialize(self.embeddings_initializer),
         'embeddings_regularizer':
         regularizers.serialize(self.embeddings_regularizer),
         'activity_regularizer':
         regularizers.serialize(self.activity_regularizer),
         'embeddings_constraint':
         constraints.serialize(self.embeddings_constraint),
         'mask_zero':
         self.mask_zero,
         'input_length':
         self.input_length
     }
     base_config = super(Embedding, self).get_config()
     return dict(list(base_config.items()) + list(config.items()))
Esempio n. 16
0
 def get_config(self):
   config = {
       'input_dim':
           self.input_dim,
       'output_dim':
           self.output_dim,
       'embeddings_initializer':
           initializers.serialize(self.embeddings_initializer),
       'embeddings_regularizer':
           regularizers.serialize(self.embeddings_regularizer),
       'activity_regularizer':
           regularizers.serialize(self.activity_regularizer),
       'embeddings_constraint':
           constraints.serialize(self.embeddings_constraint),
       'mask_zero':
           self.mask_zero,
       'input_length':
           self.input_length
   }
   base_config = super(Embedding, self).get_config()
   return dict(list(base_config.items()) + list(config.items()))
Esempio n. 17
0
 def get_config(self):
   config = super(DepthwiseConv2D, self).get_config()
   config.pop('filters')
   config.pop('kernel_initializer')
   config.pop('kernel_regularizer')
   config.pop('kernel_constraint')
   config['depth_multiplier'] = self.depth_multiplier
   config['depthwise_initializer'] = initializers.serialize(
       self.depthwise_initializer)
   config['depthwise_regularizer'] = regularizers.serialize(
       self.depthwise_regularizer)
   config['depthwise_constraint'] = constraints.serialize(
       self.depthwise_constraint)
   return config
Esempio n. 18
0
 def get_config(self):
     config = super(DepthwiseConv2D, self).get_config()
     config.pop('filters')
     config.pop('kernel_initializer')
     config.pop('kernel_regularizer')
     config.pop('kernel_constraint')
     config['depth_multiplier'] = self.depth_multiplier
     config['depthwise_initializer'] = initializers.serialize(
         self.depthwise_initializer)
     config['depthwise_regularizer'] = regularizers.serialize(
         self.depthwise_regularizer)
     config['depthwise_constraint'] = constraints.serialize(
         self.depthwise_constraint)
     return config
 def get_config(self):
     config = {
         'activation':
         activations.serialize(self.activation),
         'recurrent_activation':
         activations.serialize(self.recurrent_activation),
         'use_bias':
         self.use_bias,
         'kernel_initializer':
         initializers.serialize(self.kernel_initializer),
         'recurrent_initializer':
         initializers.serialize(self.recurrent_initializer),
         'bias_initializer':
         initializers.serialize(self.bias_initializer),
         'unit_forget_bias':
         self.unit_forget_bias,
         'kernel_regularizer':
         regularizers.serialize(self.kernel_regularizer),
         'recurrent_regularizer':
         regularizers.serialize(self.recurrent_regularizer),
         'bias_regularizer':
         regularizers.serialize(self.bias_regularizer),
         'activity_regularizer':
         regularizers.serialize(self.activity_regularizer),
         'kernel_constraint':
         constraints.serialize(self.kernel_constraint),
         'recurrent_constraint':
         constraints.serialize(self.recurrent_constraint),
         'bias_constraint':
         constraints.serialize(self.bias_constraint),
         'dropout':
         self.dropout,
         'recurrent_dropout':
         self.recurrent_dropout
     }
     base_config = super(ConvLSTM2D, self).get_config()
     return dict(list(base_config.items()) + list(config.items()))