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


Python activations.get方法代码示例

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


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

示例1: __init__

# 需要导入模块: from keras import activations [as 别名]
# 或者: from keras.activations import get [as 别名]
def __init__(self, output_dim, L,
             init='glorot_uniform', inner_init='orthogonal',
             activation='tanh', inner_activation='hard_sigmoid',
             W_regularizer=None, U_regularizer=None, b_regularizer=None,
             dropout_W=0., dropout_U=0., **kwargs):
    self.output_dim = output_dim
    self.init = initializations.get(init)
    self.inner_init = initializations.get(inner_init)
    self.activation = activations.get(activation)
    self.inner_activation = activations.get(inner_activation)
    self.W_regularizer = regularizers.get(W_regularizer)
    self.U_regularizer = regularizers.get(U_regularizer)
    self.b_regularizer = regularizers.get(b_regularizer)
    self.dropout_W, self.dropout_U = dropout_W, dropout_U
    self.L = L

    if self.dropout_W or self.dropout_U:
        self.uses_learning_phase = True
    super(RHN, self).__init__(**kwargs) 
开发者ID:LaurentMazare,项目名称:deep-models,代码行数:21,代码来源:rhn.py

示例2: __init__

# 需要导入模块: from keras import activations [as 别名]
# 或者: from keras.activations import get [as 别名]
def __init__(self,
                 filters,
                 pooling='sum',
                 kernel_initializer='glorot_uniform',
                 kernel_regularizer=None,
                 bias_initializer='zeros',
                 activation=None,
                 **kwargs):
        self.activation = activations.get(activation)
        self.kernel_initializer = initializers.get(kernel_initializer)
        self.bias_initializer = initializers.get(bias_initializer)
        self.kernel_regularizer = regularizers.get(kernel_regularizer)
        self.filters = filters
        self.pooling = pooling

        super(GraphConvS, self).__init__(**kwargs) 
开发者ID:blackmints,项目名称:3DGCN,代码行数:18,代码来源:layer.py

示例3: __init__

# 需要导入模块: from keras import activations [as 别名]
# 或者: from keras.activations import get [as 别名]
def __init__(self, feature_num,
    			feature_size,
                 embedding_size,
                 output_dim=1,
                 activation=None,
                 **kwargs):
        if 'input_shape' not in kwargs and 'input_dim' in kwargs:
            kwargs['input_shape'] = (kwargs.pop('input_dim'),)
        super(FMLayer, self).__init__(**kwargs)

        self.output_dim = output_dim
        self.embedding_size = embedding_size
        self.activation = activations.get(activation)
        self.input_spec = InputSpec(ndim=2)
        self.feature_num = feature_num
        self.feature_size = feature_size 
开发者ID:DominickZhang,项目名称:KDDCup2019_admin,代码行数:18,代码来源:fm_keras.py

示例4: __init__

# 需要导入模块: from keras import activations [as 别名]
# 或者: from keras.activations import get [as 别名]
def __init__(self, output_dim,
                 init='glorot_uniform', inner_init='orthogonal',
                 forget_bias_init='one', activation='tanh',
                 inner_activation='hard_sigmoid',
                 W_regularizer=None, U_regularizer=None, b_regularizer=None,
                 dropout_W=0., dropout_U=0., **kwargs):

		self.output_dim = output_dim
		self.init = initializations.get(init)
		self.inner_init = initializations.get(inner_init)
		self.forget_bias_init = initializations.get(forget_bias_init)
		self.activation = activations.get(activation)
		self.inner_activation = activations.get(inner_activation)
		self.W_regularizer = regularizers.get(W_regularizer)
		self.U_regularizer = regularizers.get(U_regularizer)
		self.b_regularizer = regularizers.get(b_regularizer)
		self.dropout_W, self.dropout_U = dropout_W, dropout_U

		if self.dropout_W or self.dropout_U:
			self.uses_learning_phase = True
		super(DecoderVaeLSTM, self).__init__(**kwargs) 
开发者ID:bnsnapper,项目名称:keras_bn_library,代码行数:23,代码来源:recurrent.py

示例5: __init__

# 需要导入模块: from keras import activations [as 别名]
# 或者: from keras.activations import get [as 别名]
def __init__(self, output_dim, memory_dim=128, memory_size=20,
                 controller_output_dim=100, location_shift_range=1,
                 num_read_head=1, num_write_head=1,
                 init='glorot_uniform', inner_init='orthogonal',
                 forget_bias_init='one', activation='tanh',
                 inner_activation='hard_sigmoid',
                 W_regularizer=None, U_regularizer=None, R_regularizer=None,
                 b_regularizer=None, W_y_regularizer=None,
                 W_xi_regularizer=None, W_r_regularizer=None,
                 dropout_W=0., dropout_U=0., **kwargs):
        self.output_dim = output_dim
        self.init = initializations.get(init)
        self.inner_init = initializations.get(inner_init)
        self.forget_bias_init = initializations.get(forget_bias_init)
        self.activation = activations.get(activation)
        self.inner_activation = activations.get(inner_activation)
        self.W_regularizer = regularizers.get(W_regularizer)
        self.U_regularizer = regularizers.get(U_regularizer)
        self.b_regularizer = regularizers.get(b_regularizer)
        self.dropout_W, self.dropout_U = dropout_W, dropout_U

        if self.dropout_W or self.dropout_U:
            self.uses_learning_phase = True
        super(NTM, self).__init__(**kwargs) 
开发者ID:SigmaQuan,项目名称:NTM-Keras,代码行数:26,代码来源:lstm2ntm.py

示例6: __init__

# 需要导入模块: from keras import activations [as 别名]
# 或者: from keras.activations import get [as 别名]
def __init__(self, output_dim, inner_dim, depth = 2, init_output='uniform', 
			activation_output='softmax', init_inner='identity',
			activation_inner='linear', scale_output=0.01, padding=False, **kwargs):
		if depth < 1:
			quit('Cannot use GraphFP with depth zero')
		self.init_output = initializations.get(init_output)
		self.activation_output = activations.get(activation_output)
		self.init_inner = initializations.get(init_inner)
		self.activation_inner = activations.get(activation_inner)
		self.output_dim = output_dim
		self.inner_dim = inner_dim
		self.depth = depth
		self.scale_output = scale_output
		self.padding = padding

		self.initial_weights = None
		self.input_dim = 4 # each entry is a 3D N_atom x N_atom x N_feature tensor
		if self.input_dim:
			kwargs['input_shape'] = (None, None, None,) # 3D tensor for each input
		#self.input = K.placeholder(ndim = 4)
		super(GraphFP, self).__init__(**kwargs) 
开发者ID:connorcoley,项目名称:conv_qsar_fast,代码行数:23,代码来源:GraphEmbedding_sumAfter.py

示例7: __init__

# 需要导入模块: from keras import activations [as 别名]
# 或者: from keras.activations import get [as 别名]
def __init__(
        self,
        heads,
        head_size,
        key_size=None,
        use_bias=True,
        attention_scale=True,
        kernel_initializer='glorot_uniform',
        **kwargs
    ):
        super(MultiHeadAttention, self).__init__(**kwargs)
        self.heads = heads
        self.head_size = head_size
        self.out_dim = heads * head_size
        self.key_size = key_size or head_size
        self.use_bias = use_bias
        self.attention_scale = attention_scale
        self.kernel_initializer = initializers.get(kernel_initializer) 
开发者ID:bojone,项目名称:bert4keras,代码行数:20,代码来源:layers.py

示例8: evaluate

# 需要导入模块: from keras import activations [as 别名]
# 或者: from keras.activations import get [as 别名]
def evaluate(self, inputs, fn_inverse=None, fn_plot=None):
        try:
            X, y = inputs
            inputs = X
        except:
            X, conditions, y = inputs
            inputs = [X, conditions]

        y_hat = self.predict(inputs)

        if fn_inverse is not None:
            y_hat = fn_inverse(y_hat)
            y = fn_inverse(y)

        if fn_plot is not None:
            fn_plot([y, y_hat])

        results = []
        for m in self.model.metrics:
            if isinstance(m, str):
                results.append(K.eval(K.mean(get(m)(y, y_hat))))
            else:
                results.append(K.eval(K.mean(m(y, y_hat))))
        return results 
开发者ID:albertogaspar,项目名称:dts,代码行数:26,代码来源:FFNN.py

示例9: __init__

# 需要导入模块: from keras import activations [as 别名]
# 或者: from keras.activations import get [as 别名]
def __init__(self, units, kernel_initializer='glorot_uniform',
                 activation=None, weights=None,
                 kernel_regularizer=None, bias_regularizer=None,
                 activity_regularizer=None,
                 kernel_constraint=None, bias_constraint=None,
                 use_bias=True, **kwargs):
        if 'input_shape' not in kwargs and 'input_dim' in kwargs:
            kwargs['input_shape'] = (kwargs.pop('input_dim'),)

        self.kernel_initializer = initializers.get(kernel_initializer)
        self.activation = activations.get(activation)
        self.units = units

        self.kernel_regularizer = regularizers.get(kernel_regularizer)
        self.bias_regularizer = regularizers.get(bias_regularizer)
        self.activity_regularizer = regularizers.get(activity_regularizer)

        self.kernel_constraint = constraints.get(kernel_constraint)
        self.bias_constraint = constraints.get(bias_constraint)

        self.use_bias = use_bias
        self.initial_weights = weights
        super(CosineDense, self).__init__(**kwargs) 
开发者ID:keras-team,项目名称:keras-contrib,代码行数:25,代码来源:core.py

示例10: __init__

# 需要导入模块: from keras import activations [as 别名]
# 或者: from keras.activations import get [as 别名]
def __init__(self,
                 num_capsule,
                 dim_capsule,
                 routings=3,
                 share_weights=True,
                 initializer='glorot_uniform',
                 activation=None,
                 regularizer=None,
                 constraint=None,
                 **kwargs):
        super(Capsule, self).__init__(**kwargs)
        self.num_capsule = num_capsule
        self.dim_capsule = dim_capsule
        self.routings = routings
        self.share_weights = share_weights

        self.activation = activations.get(activation)
        self.regularizer = regularizers.get(regularizer)
        self.initializer = initializers.get(initializer)
        self.constraint = constraints.get(constraint) 
开发者ID:keras-team,项目名称:keras-contrib,代码行数:22,代码来源:capsule.py

示例11: __init__

# 需要导入模块: from keras import activations [as 别名]
# 或者: from keras.activations import get [as 别名]
def __init__(
        self,
        units: int = 10,
        activation: str = 'tanh',
        recurrent_activation: str = 'sigmoid',
        kernel_initializer: str = 'glorot_uniform',
        recurrent_initializer: str = 'orthogonal',
        direction: str = 'lt',
        **kwargs
    ):
        """:class:`SpatialGRU` constructor."""
        super().__init__(**kwargs)
        self._units = units
        self._activation = activations.get(activation)
        self._recurrent_activation = activations.get(recurrent_activation)

        self._kernel_initializer = initializers.get(kernel_initializer)
        self._recurrent_initializer = initializers.get(recurrent_initializer)
        self._direction = direction 
开发者ID:NTMC-Community,项目名称:MatchZoo,代码行数:21,代码来源:spatial_gru.py

示例12: __init__

# 需要导入模块: from keras import activations [as 别名]
# 或者: from keras.activations import get [as 别名]
def __init__(self, nb_filters_in, nb_filters_out, nb_filters_att, nb_rows, nb_cols,
                 init='normal', inner_init='orthogonal', attentive_init='zero',
                 activation='tanh', inner_activation='sigmoid',
                 W_regularizer=None, U_regularizer=None,
                 weights=None, go_backwards=False,
                 **kwargs):
        self.nb_filters_in = nb_filters_in
        self.nb_filters_out = nb_filters_out
        self.nb_filters_att = nb_filters_att
        self.nb_rows = nb_rows
        self.nb_cols = nb_cols
        self.init = initializations.get(init)
        self.inner_init = initializations.get(inner_init)
        self.attentive_init = initializations.get(attentive_init)
        self.activation = activations.get(activation)
        self.inner_activation = activations.get(inner_activation)
        self.initial_weights = weights
        self.go_backwards = go_backwards

        self.W_regularizer = W_regularizer
        self.U_regularizer = U_regularizer
        self.input_spec = [InputSpec(ndim=5)]

        super(AttentiveConvLSTM, self).__init__(**kwargs) 
开发者ID:marcellacornia,项目名称:sam,代码行数:26,代码来源:attentive_convlstm.py

示例13: __init__

# 需要导入模块: from keras import activations [as 别名]
# 或者: from keras.activations import get [as 别名]
def __init__(self, output_dim, output_length,
               init='glorot_uniform', inner_init='orthogonal',
               activation='tanh',
               W_regularizer=None, U_regularizer=None, b_regularizer=None,
               dropout_W=0., dropout_U=0., **kwargs):
      self.output_dim = output_dim
      self.output_length = output_length
      self.init = initializations.get(init)
      self.inner_init = initializations.get(inner_init)
      self.activation = activations.get(activation)
      self.W_regularizer = regularizers.get(W_regularizer)
      self.U_regularizer = regularizers.get(U_regularizer)
      self.b_regularizer = regularizers.get(b_regularizer)
      self.dropout_W, self.dropout_U = dropout_W, dropout_U

      if self.dropout_W or self.dropout_U:
          self.uses_learning_phase = True
      super(DreamyRNN, self).__init__(**kwargs) 
开发者ID:commaai,项目名称:research,代码行数:20,代码来源:layers.py

示例14: __init__

# 需要导入模块: from keras import activations [as 别名]
# 或者: from keras.activations import get [as 别名]
def __init__(self, output_dim, init='glorot_uniform', activation='relu',weights=None,
            W_regularizer=None, b_regularizer=None, activity_regularizer=None,
            W_constraint=None, b_constraint=None, input_dim=None, **kwargs):
        self.W_initializer = initializers.get(init)
        self.b_initializer = initializers.get('zeros')
        self.activation = activations.get(activation)
        self.output_dim = output_dim
        self.input_dim = input_dim

        self.W_regularizer = regularizers.get(W_regularizer)
        self.b_regularizer = regularizers.get(b_regularizer)
        self.activity_regularizer = regularizers.get(activity_regularizer)

        self.W_constraint = constraints.get(W_constraint)
        self.b_constraint = constraints.get(b_constraint)
        self.initial_weights = weights
        self.input_spec = InputSpec(ndim=2)

        if self.input_dim:
            kwargs['input_shape'] = (self.input_dim,)
        super(SparseFullyConnectedLayer, self).__init__(**kwargs) 
开发者ID:yangliuy,项目名称:NeuralResponseRanking,代码行数:23,代码来源:SparseFullyConnectedLayer.py

示例15: __init__

# 需要导入模块: from keras import activations [as 别名]
# 或者: from keras.activations import get [as 别名]
def __init__(self,
                 num_capsule,
                 dim_capsule,
                 routings=3,
                 share_weights=True,
                 activation='squash',
                 **kwargs):
        super(Capsule, self).__init__(**kwargs)
        self.num_capsule = num_capsule
        self.dim_capsule = dim_capsule
        self.routings = routings
        self.share_weights = share_weights
        if activation == 'squash':
            self.activation = squash
        else:
            self.activation = activations.get(activation) 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:18,代码来源:cifar10_cnn_capsule.py


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