当前位置: 首页>>代码示例>>Python>>正文


Python initializers.serialize函数代码示例

本文整理汇总了Python中tensorflow.python.keras.initializers.serialize函数的典型用法代码示例。如果您正苦于以下问题:Python serialize函数的具体用法?Python serialize怎么用?Python serialize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了serialize函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_config

 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(BatchNormalizationBase, self).get_config()
   return dict(list(base_config.items()) + list(config.items()))
开发者ID:adit-chandra,项目名称:tensorflow,代码行数:34,代码来源:normalization.py

示例2: get_config

 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()))
开发者ID:AnishShah,项目名称:tensorflow,代码行数:31,代码来源:convolutional_recurrent.py

示例3: get_config

 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),
       'implementation':
           self.implementation
   }
   base_config = super(LocallyConnected2D, self).get_config()
   return dict(list(base_config.items()) + list(config.items()))
开发者ID:AnishShah,项目名称:tensorflow,代码行数:35,代码来源:local.py

示例4: get_config

 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()))
开发者ID:yanchen036,项目名称:tensorflow,代码行数:16,代码来源:core.py

示例5: get_config

 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()))
开发者ID:Wajih-O,项目名称:tensorflow,代码行数:9,代码来源:advanced_activations.py

示例6: get_config

 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()))
开发者ID:didukhle,项目名称:tensorflow,代码行数:20,代码来源:cudnn_recurrent.py

示例7: get_config

 def get_config(self):
   kernel_initializer = self.kernel_initializer
   if isinstance(self.kernel_initializer, init_ops.Initializer):
     kernel_initializer = initializers.serialize(self.kernel_initializer)
   config = {
       'output_dim': self.output_dim,
       'kernel_initializer': kernel_initializer,
       'scale': self.scale,
   }
   base_config = super(RandomFourierFeatures, self).get_config()
   return dict(list(base_config.items()) + list(config.items()))
开发者ID:adit-chandra,项目名称:tensorflow,代码行数:11,代码来源:kernelized.py

示例8: get_config

 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()))
开发者ID:adit-chandra,项目名称:tensorflow,代码行数:17,代码来源:embeddings.py

示例9: get_config

 def get_config(self):
   config = {
       "num_units": self._num_units,
       "use_peepholes": self._use_peepholes,
       "cell_clip": self._cell_clip,
       "initializer": initializers.serialize(self._initializer),
       "num_proj": self._num_proj,
       "proj_clip": self._proj_clip,
       "num_unit_shards": self._num_unit_shards,
       "num_proj_shards": self._num_proj_shards,
       "forget_bias": self._forget_bias,
       "state_is_tuple": self._state_is_tuple,
       "activation": activations.serialize(self._activation),
       "reuse": self._reuse,
   }
   base_config = super(TFLiteLSTMCell, self).get_config()
   return dict(list(base_config.items()) + list(config.items()))
开发者ID:ThunderQi,项目名称:tensorflow,代码行数:17,代码来源:tflite_lstm.py

示例10: test_get_config

  def test_get_config(self, output_dim, initializer, scale, trainable):
    rff_layer = kernel_layers.RandomFourierFeatures(
        output_dim,
        initializer,
        scale=scale,
        trainable=trainable,
        name='random_fourier_features',
    )
    expected_initializer = initializer
    if isinstance(initializer, init_ops.Initializer):
      expected_initializer = initializers.serialize(initializer)

    expected_config = {
        'output_dim': output_dim,
        'kernel_initializer': expected_initializer,
        'scale': scale,
        'name': 'random_fourier_features',
        'trainable': trainable,
        'dtype': None,
    }
    self.assertLen(expected_config, len(rff_layer.get_config()))
    self.assertSameElements(
        list(expected_config.items()), list(rff_layer.get_config().items()))
开发者ID:rmlarsen,项目名称:tensorflow,代码行数:23,代码来源:kernelized_test.py


注:本文中的tensorflow.python.keras.initializers.serialize函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。