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


Python regularizers.get方法代码示例

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


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

示例1: __init__

# 需要导入模块: from tensorflow.python.keras import regularizers [as 别名]
# 或者: from tensorflow.python.keras.regularizers import get [as 别名]
def __init__(self,
                 input_dim,
                 output_dim,
                 dropout_rate=0.0,
                 activation='tanh',
                 kernel_initializer='glorot_uniform',
                 bias_initializer='zeros'):
        super(HighwayLayer, self).__init__()
        self.activation = activations.get(activation)
        self.kernel_initializer = initializers.get(kernel_initializer)
        self.bias_initializer = initializers.get(bias_initializer)

        self.dropout_rate = dropout_rate

        self.shape = (input_dim, output_dim)
        self.input_dim = input_dim
        self.output_dim = output_dim

        self.kernel = None
        self.bias = None 
开发者ID:nju-websoft,项目名称:AliNet,代码行数:22,代码来源:alinet_layer.py

示例2: __init__

# 需要导入模块: from tensorflow.python.keras import regularizers [as 别名]
# 或者: from tensorflow.python.keras.regularizers import get [as 别名]
def __init__(self,units,
                 activation=None,
                 kernel_initializer='glorot_uniform',
                 kernel_regularizer=None,
                 kernel_constraint=None,
                 use_bias=False,
                 bias_initializer="zeros",
                 trainable=True,
                 name=None):
        super(Dense3D,self).__init__(trainable=trainable,name=name)
        self.units = units
        self.activation = activations.get(activation)
        self.kernel_initializer = initializers.get(kernel_initializer)
        self.kernel_regularizer = regularizers.get(kernel_regularizer)
        self.kernel_constraint = constraints.get(kernel_constraint)
        self.use_bias=use_bias
        self.bias_initializer = bias_initializer 
开发者ID:LongxingTan,项目名称:Time-series-prediction,代码行数:19,代码来源:wavenet_layer.py

示例3: __init__

# 需要导入模块: from tensorflow.python.keras import regularizers [as 别名]
# 或者: from tensorflow.python.keras.regularizers import get [as 别名]
def __init__(self, alpha_fwd=0.999, alpha_bkw=0.99,
                 axis=1, epsilon=1e-5,
                 stream_mu_initializer='zeros', stream_var_initializer='ones',
                 u_ctrl_initializer='zeros', v_ctrl_initializer='zeros',
                 trainable=True, name=None, **kwargs):
        super(Norm, self).__init__(trainable=trainable, name=name, **kwargs)
        # setup mixed precesion
        self.dtype_policy = self._mixed_precision_policy \
            if self._mixed_precision_policy.name == "infer_float32_vars" \
                else self._dtype

        if isinstance(self.dtype_policy, Policy):
            self.mixed_precision = True
            self.fp_type = tf.float32 # full precision
            self.mp_type = tf.float16 # reduced precision
        else:
            self.mixed_precision = False
            self.fp_type = self._dtype if self._dtype else tf.float32 # full precision
            self.mp_type = self.fp_type # reduced precision

        assert axis == 1, 'kernel requires channels_first data_format'

        self.axis = axis
        self.norm_ax = None
        self.epsilon = epsilon

        self.alpha_fwd = alpha_fwd
        self.alpha_bkw = alpha_bkw

        self.stream_mu_initializer = initializers.get(stream_mu_initializer)
        self.stream_var_initializer = initializers.get(stream_var_initializer)
        self.u_ctrl_initializer = initializers.get(u_ctrl_initializer)
        self.v_ctrl_initializer = initializers.get(v_ctrl_initializer) 
开发者ID:Cerebras,项目名称:online-normalization,代码行数:35,代码来源:online_norm.py

示例4: __init__

# 需要导入模块: from tensorflow.python.keras import regularizers [as 别名]
# 或者: from tensorflow.python.keras.regularizers import get [as 别名]
def __init__(self,
                 input_dim,
                 output_dim,
                 adj,
                 num_features_nonzero,
                 dropout_rate=0.0,
                 is_sparse_inputs=False,
                 activation=None,
                 use_bias=True,
                 kernel_initializer='glorot_uniform',
                 bias_initializer='zeros',
                 kernel_regularizer='l2',
                 bias_regularizer='l2',
                 activity_regularizer=None,
                 kernel_constraint=None,
                 bias_constraint=None,
                 **kwargs):
        super(GraphConvolution, self).__init__()
        self.activation = activations.get(activation)
        self.use_bias = use_bias
        self.kernel_initializer = initializers.get(kernel_initializer)
        self.bias_initializer = initializers.get(bias_initializer)
        self.kernel_regularizer = regularizers.get(kernel_regularizer)
        self.bias_regularizer = regularizers.get(bias_regularizer)
        self.kernel_constraint = constraints.get(kernel_constraint)
        self.bias_constraint = constraints.get(bias_constraint)

        self.kernels = list()
        self.bias = None
        self.input_dim = input_dim
        self.output_dim = output_dim
        self.is_sparse_inputs = is_sparse_inputs
        self.num_features_nonzero = num_features_nonzero
        self.adjs = [tf.SparseTensor(indices=am[0], values=am[1], dense_shape=am[2]) for am in adj]
        self.dropout_rate = dropout_rate 
开发者ID:nju-websoft,项目名称:AliNet,代码行数:37,代码来源:layers.py

示例5: __init__

# 需要导入模块: from tensorflow.python.keras import regularizers [as 别名]
# 或者: from tensorflow.python.keras.regularizers import get [as 别名]
def __init__(self,
                 input_dim,
                 output_dim,
                 adj,
                 num_features_nonzero,
                 dropout_rate=0.0,
                 num_base=-1,
                 is_sparse_inputs=False,
                 featureless=False,
                 activation=None,
                 use_bias=True,
                 kernel_initializer='glorot_uniform',
                 bias_initializer='zeros',
                 kernel_regularizer="l2",
                 bias_regularizer=None,
                 kernel_constraint=None,
                 bias_constraint=None,
                 **kwargs):
        super(RGraphConvolutionLayer, self).__init__()
        self.activation = activations.get(activation)
        self.use_bias = use_bias
        self.kernel_initializer = initializers.get(kernel_initializer)
        self.bias_initializer = initializers.get(bias_initializer)
        self.kernel_regularizer = regularizers.get(kernel_regularizer)
        self.bias_regularizer = regularizers.get(bias_regularizer)
        self.kernel_constraint = constraints.get(kernel_constraint)
        self.bias_constraint = constraints.get(bias_constraint)
        self.bias = None
        self.input_dim = input_dim
        self.output_dim = output_dim
        self.is_sparse_inputs = is_sparse_inputs
        self.featureless = featureless
        self.num_features_nonzero = num_features_nonzero
        self.support = len(adj)
        self.adj_list = [tf.SparseTensor(indices=adj[i][0], values=adj[i][1], dense_shape=adj[i][2])
                         for i in range(len(adj))]
        self.dropout_rate = dropout_rate
        self.num_bases = num_base
        self.W = list() 
开发者ID:nju-websoft,项目名称:AliNet,代码行数:41,代码来源:layers.py

示例6: __init__

# 需要导入模块: from tensorflow.python.keras import regularizers [as 别名]
# 或者: from tensorflow.python.keras.regularizers import get [as 别名]
def __init__(self,
                 kernel_initializer = 'glorot_uniform',
                 kernel_regularizer=None,
                 kernel_constraint=None,
                 **kwargs):
        if 'input_shape' not in kwargs and 'input_dim' in kwargs:
            kwargs['input_shape'] = (kwargs.pop('input_dim'),)
            
        super(StressIntensityRange, self).__init__(**kwargs)
        self.kernel_initializer = initializers.get(kernel_initializer)
        self.kernel_regularizer = regularizers.get(kernel_regularizer)
        self.kernel_constraint  = constraints.get(kernel_constraint) 
开发者ID:PML-UCF,项目名称:pinn,代码行数:14,代码来源:physics.py

示例7: __init__

# 需要导入模块: from tensorflow.python.keras import regularizers [as 别名]
# 或者: from tensorflow.python.keras.regularizers import get [as 别名]
def __init__(self,
                 kernel_initializer = 'glorot_uniform',
                 kernel_regularizer=None,
                 kernel_constraint=None,
                 table_shape=(1,4,4,1),
                 **kwargs):
        if 'input_shape' not in kwargs and 'input_dim' in kwargs:
            kwargs['input_shape'] = (kwargs.pop('input_dim'),)
        super(TableInterpolation, self).__init__(**kwargs)
        self.kernel_initializer = initializers.get(kernel_initializer)
        self.kernel_regularizer = regularizers.get(kernel_regularizer)
        self.kernel_constraint  = constraints.get(kernel_constraint)
        
        self.table_shape = table_shape 
开发者ID:PML-UCF,项目名称:pinn,代码行数:16,代码来源:core.py

示例8: __init__

# 需要导入模块: from tensorflow.python.keras import regularizers [as 别名]
# 或者: from tensorflow.python.keras.regularizers import get [as 别名]
def __init__(self,
                 units,
                 relations,
                 kernel_basis_size=None,
                 activation=None,
                 use_bias=False,
                 batch_normalisation=False,
                 kernel_initializer='glorot_uniform',
                 bias_initializer='zeros',
                 kernel_regularizer=None,
                 bias_regularizer=None,
                 activity_regularizer=None,
                 kernel_constraint=None,
                 bias_constraint=None,
                 feature_dropout=None,
                 support_dropout=None,
                 name='relational_graph_conv',
                 **kwargs):
        if 'input_shape' not in kwargs and 'input_dim' in kwargs:
            kwargs['input_shape'] = (kwargs.pop('input_dim'),)

        super(RelationalGraphConv, self).__init__(
            activity_regularizer=regularizers.get(activity_regularizer),
            name=name, **kwargs)

        self.units = int(units)
        self.relations = int(relations)
        self.kernel_basis_size = (int(kernel_basis_size)
                                  if kernel_basis_size is not None else None)
        self.activation = activations.get(activation)
        self.use_bias = use_bias
        self.batch_normalisation = batch_normalisation
        self.kernel_initializer = initializers.get(kernel_initializer)
        self.bias_initializer = initializers.get(bias_initializer)
        self.kernel_regularizer = regularizers.get(kernel_regularizer)
        self.bias_regularizer = regularizers.get(bias_regularizer)
        self.kernel_constraint = constraints.get(kernel_constraint)
        self.bias_constraint = constraints.get(bias_constraint)
        self.feature_dropout = feature_dropout
        self.support_dropout = support_dropout

        self.supports_masking = True
        self.input_spec = InputSpec(min_ndim=2)

        self.dense_layer = rgat_layers.BasisDecompositionDense(
            units=self.units * self.relations,
            basis_size=self.kernel_basis_size,
            coefficients_size=self.relations,
            use_bias=False,
            kernel_initializer=self.kernel_initializer,
            kernel_regularizer=self.kernel_regularizer,
            kernel_constraint=self.kernel_constraint,
            name=name + '_basis_decomposition_dense',
            **kwargs)
        if self.batch_normalisation:
            self.batch_normalisation_layer = tf.layers.BatchNormalization() 
开发者ID:babylonhealth,项目名称:rgat,代码行数:58,代码来源:relational_graph_convolution.py


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