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


Python activations.serialize方法代码示例

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


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

示例1: get_config

# 需要导入模块: from tensorflow.keras import activations [as 别名]
# 或者: from tensorflow.keras.activations import serialize [as 别名]
def get_config(self) -> dict:
    config = {
        'filters': self.filters,
        'kernel_size': self.kernel_size,
        'num_nodes': self.num_nodes,
        'bond_dim': self.bond_dim,
        'strides': self.strides,
        'padding': self.padding,
        'data_format': self.data_format,
        'dilation_rate': self.dilation_rate,
        '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),
    }
    base_config = super(Conv2DMPO, self).get_config()
    config.update(base_config)
    return config 
开发者ID:google,项目名称:TensorNetwork,代码行数:22,代码来源:conv2d_mpo.py

示例2: get_config

# 需要导入模块: from tensorflow.keras import activations [as 别名]
# 或者: from tensorflow.keras.activations import serialize [as 别名]
def get_config(self):
        config = {
            "input_channels": self.input_channels,
            "output_channels": self.output_channels,
            "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),
            "groups": self.groups,
            "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(GroupConv2D, self).get_config()
        return {**base_config, **config} 
开发者ID:calmisential,项目名称:Basic_CNNs_TensorFlow2,代码行数:24,代码来源:group_convolution.py

示例3: serialize_kwarg

# 需要导入模块: from tensorflow.keras import activations [as 别名]
# 或者: from tensorflow.keras.activations import serialize [as 别名]
def serialize_kwarg(key, attr):
    if key.endswith('_initializer'):
        return initializers.serialize(attr)
    if key.endswith('_regularizer'):
        return regularizers.serialize(attr)
    if key.endswith('_constraint'):
        return constraints.serialize(attr)
    if key == 'activation':
        return activations.serialize(attr)
    if key == 'use_bias':
        return attr 
开发者ID:danielegrattarola,项目名称:spektral,代码行数:13,代码来源:keras.py

示例4: get_config

# 需要导入模块: from tensorflow.keras import activations [as 别名]
# 或者: from tensorflow.keras.activations import serialize [as 别名]
def get_config(self):
        config = {
            'channels': self.channels,
            '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),
            'kernel_constraint': constraints.serialize(self.kernel_constraint),
            'bias_constraint': constraints.serialize(self.bias_constraint)
        }
        base_config = super().get_config()
        return dict(list(base_config.items()) + list(config.items())) 
开发者ID:danielegrattarola,项目名称:spektral,代码行数:16,代码来源:graph_conv.py

示例5: get_config

# 需要导入模块: from tensorflow.keras import activations [as 别名]
# 或者: from tensorflow.keras.activations import serialize [as 别名]
def get_config(self):
        config = {
            'iterations': self.iterations,
            'order': self.order,
            'share_weights': self.share_weights,
            'gcn_activation': activations.serialize(self.gcn_activation),
            'dropout_rate': self.dropout_rate,
        }
        base_config = super().get_config()
        return dict(list(base_config.items()) + list(config.items())) 
开发者ID:danielegrattarola,项目名称:spektral,代码行数:12,代码来源:arma_conv.py

示例6: get_config

# 需要导入模块: from tensorflow.keras import activations [as 别名]
# 或者: from tensorflow.keras.activations import serialize [as 别名]
def get_config(self):
        config = {
            'alpha': self.alpha,
            'propagations': self.propagations,
            'mlp_hidden': self.mlp_hidden,
            'mlp_activation': activations.serialize(self.mlp_activation),
            'dropout_rate': self.dropout_rate,
        }
        base_config = super().get_config()
        return dict(list(base_config.items()) + list(config.items())) 
开发者ID:danielegrattarola,项目名称:spektral,代码行数:12,代码来源:appnp.py

示例7: get_config

# 需要导入模块: from tensorflow.keras import activations [as 别名]
# 或者: from tensorflow.keras.activations import serialize [as 别名]
def get_config(self):
    config = {
        "units": self.units,
        "activation": activations.serialize(self.activation),
        "use_bias": self.use_bias,
        "kernel_quantizer":
            constraints.serialize(self.kernel_quantizer_internal),
        "bias_quantizer":
            constraints.serialize(self.bias_quantizer_internal),
        "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),
        "kernel_range": self.kernel_range,
        "bias_range": self.bias_range
    }
    base_config = super(QDense, self).get_config()
    return dict(list(base_config.items()) + list(config.items())) 
开发者ID:google,项目名称:qkeras,代码行数:30,代码来源:qlayers.py

示例8: get_config

# 需要导入模块: from tensorflow.keras import activations [as 别名]
# 或者: from tensorflow.keras.activations import serialize [as 别名]
def get_config(self) -> dict:
    """Returns the config of the layer.

    The same layer can be reinstantiated later
    (without its trained weights) from this configuration.

    Returns:
      Python dictionary containing the configuration of the layer.
    """
    config = {}

    # Include the Entangler-specific arguments
    args = ['output_dim', 'num_legs', 'num_levels', 'use_bias']
    for arg in args:
      config[arg] = getattr(self, arg)

    # Serialize the activation
    config['activation'] = activations.serialize(getattr(self, 'activation'))

    # Serialize the initializers
    layer_initializers = ['kernel_initializer', 'bias_initializer']
    for initializer_arg in layer_initializers:
      config[initializer_arg] = initializers.serialize(
          getattr(self, initializer_arg))

    # Get base config
    base_config = super(DenseEntangler, self).get_config()
    return dict(list(base_config.items()) + list(config.items())) 
开发者ID:google,项目名称:TensorNetwork,代码行数:30,代码来源:entangler.py

示例9: get_config

# 需要导入模块: from tensorflow.keras import activations [as 别名]
# 或者: from tensorflow.keras.activations import serialize [as 别名]
def get_config(self) -> dict:
    """Returns the config of the layer.

    The same layer can be reinstantiated later
    (without its trained weights) from this configuration.

    Returns:
      Python dictionary containing the configuration of the layer.
    """
    config = {}

    # Include the DenseDecomp-specific arguments
    decomp_args = ['output_dim', 'decomp_size', 'use_bias']
    for arg in decomp_args:
      config[arg] = getattr(self, arg)

    # Serialize the activation
    config['activation'] = activations.serialize(getattr(self, 'activation'))

    # Serialize the initializers
    decomp_initializers = ['kernel_initializer', 'bias_initializer']
    for initializer_arg in decomp_initializers:
      config[initializer_arg] = initializers.serialize(
          getattr(self, initializer_arg))

    # Get base config
    base_config = super(DenseDecomp, self).get_config()
    return dict(list(base_config.items()) + list(config.items())) 
开发者ID:google,项目名称:TensorNetwork,代码行数:30,代码来源:dense.py

示例10: get_config

# 需要导入模块: from tensorflow.keras import activations [as 别名]
# 或者: from tensorflow.keras.activations import serialize [as 别名]
def get_config(self) -> dict:
    """Returns the config of the layer.

    The same layer can be reinstantiated later
    (without its trained weights) from this configuration.

    Returns:
      Python dictionary containing the configuration of the layer.
    """
    config = {}

    # Include the MPO-specific arguments
    args = ['output_dim', 'num_nodes', 'bond_dim', 'use_bias']
    for arg in args:
      config[arg] = getattr(self, arg)

    # Serialize the activation
    config['activation'] = activations.serialize(getattr(self, 'activation'))

    # Serialize the initializers
    custom_initializers = ['kernel_initializer', 'bias_initializer']
    for initializer_arg in custom_initializers:
      config[initializer_arg] = initializers.serialize(
          getattr(self, initializer_arg))

    # Get base config
    base_config = super(DenseMPO, self).get_config()
    return dict(list(base_config.items()) + list(config.items())) 
开发者ID:google,项目名称:TensorNetwork,代码行数:30,代码来源:mpo.py

示例11: get_config

# 需要导入模块: from tensorflow.keras import activations [as 别名]
# 或者: from tensorflow.keras.activations import serialize [as 别名]
def get_config(self) -> dict:
    """Returns the config of the layer.

    The same layer can be reinstantiated later
    (without its trained weights) from this configuration.

    Returns:
      Python dictionary containing the configuration of the layer.
    """
    config = {}

    # Include the Condenser-specific arguments
    args = ['exp_base', 'num_nodes', 'use_bias']
    for arg in args:
      config[arg] = getattr(self, arg)

    # Serialize the activation
    config['activation'] = activations.serialize(getattr(self, 'activation'))

    # Serialize the initializers
    initializers_list = ['kernel_initializer', 'bias_initializer']
    for initializer_arg in initializers_list:
      config[initializer_arg] = initializers.serialize(
          getattr(self, initializer_arg))

    # Get base config
    base_config = super(DenseCondenser, self).get_config()
    return dict(list(base_config.items()) + list(config.items())) 
开发者ID:google,项目名称:TensorNetwork,代码行数:30,代码来源:condenser.py

示例12: get_config

# 需要导入模块: from tensorflow.keras import activations [as 别名]
# 或者: from tensorflow.keras.activations import serialize [as 别名]
def get_config(self):
        config = {"T": self.T,
                  "n_hidden": self.n_hidden,
                  "activation": activations.serialize(self.activation),
                  "activation_lstm": activations.serialize(
                      self.activation_lstm),
                  "recurrent_activation": activations.serialize(
                      self.recurrent_activation),
                  "kernel_initializer": initializers.serialize(
                      self.kernel_initializer),
                  "recurrent_initializer": initializers.serialize(
                      self.recurrent_initializer),
                  "bias_initializer": initializers.serialize(
                      self.bias_initializer),
                  "use_bias": self.use_bias,
                  "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)

                  }
        base_config = super().get_config()
        return dict(list(base_config.items()) + list(config.items())) 
开发者ID:materialsvirtuallab,项目名称:megnet,代码行数:33,代码来源:set2set.py


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