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


Python initializations.get方法代码示例

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


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

示例1: __init__

# 需要导入模块: from keras import initializations [as 别名]
# 或者: from keras.initializations 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 initializations [as 别名]
# 或者: from keras.initializations 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

示例3: __init__

# 需要导入模块: from keras import initializations [as 别名]
# 或者: from keras.initializations 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

示例4: __init__

# 需要导入模块: from keras import initializations [as 别名]
# 或者: from keras.initializations import get [as 别名]
def __init__(self, init='glorot_uniform',
                 U_regularizer=None, b_start_regularizer=None, b_end_regularizer=None,
                 U_constraint=None, b_start_constraint=None, b_end_constraint=None,
                 weights=None,
                 **kwargs):
        self.supports_masking = True
        self.uses_learning_phase = True
        self.input_spec = [InputSpec(ndim=3)]
        self.init = initializations.get(init)

        self.U_regularizer = regularizers.get(U_regularizer)
        self.b_start_regularizer = regularizers.get(b_start_regularizer)
        self.b_end_regularizer = regularizers.get(b_end_regularizer)
        self.U_constraint = constraints.get(U_constraint)
        self.b_start_constraint = constraints.get(b_start_constraint)
        self.b_end_constraint = constraints.get(b_end_constraint)

        self.initial_weights = weights

        super(ChainCRF, self).__init__(**kwargs) 
开发者ID:UKPLab,项目名称:naacl18-multitask_argument_mining,代码行数:22,代码来源:ChainCRF.py

示例5: __init__

# 需要导入模块: from keras import initializations [as 别名]
# 或者: from keras.initializations import get [as 别名]
def __init__(self, input_dim, output_dim, octave=True):
        super(GaborFit, self).__init__()
        init0 = initializations.get('zero')
        init1 = initializations.get('uniform')
        xydim = np.sqrt(output_dim)
        x, y = np.meshgrid(*(np.linspace(-1, 1, xydim),)*2)
        self.x = theano.shared(x.ravel().astype(floatX))
        self.y = theano.shared(y.ravel().astype(floatX))
        self.x0 = init0((input_dim,))
        self.y0 = init0((input_dim,))
        self.theta = init0((input_dim,))
        self.omega = init1((input_dim,))
        self.input = tensor.matrix()
        if octave:
            self.kappa = 2.5
        else:
            self.kappa = np.pi
        self.params = [self.x0, self.y0, self.theta, self.omega] 
开发者ID:AgnezIO,项目名称:agnez,代码行数:20,代码来源:gaborfitting.py

示例6: __init__

# 需要导入模块: from keras import initializations [as 别名]
# 或者: from keras.initializations 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

示例7: __init__

# 需要导入模块: from keras import initializations [as 别名]
# 或者: from keras.initializations 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

示例8: __init__

# 需要导入模块: from keras import initializations [as 别名]
# 或者: from keras.initializations import get [as 别名]
def __init__(self, input_dim, output_dim, init='uniform', input_length=None,
                 W_regularizer=None, activity_regularizer=None, W_constraint=None,
                 mask_zero=False, weights=None, **kwargs):
        self.input_dim = input_dim
        self.output_dim = output_dim
        self.init = initializations.get(init)
        self.input_length = input_length
        self.mask_zero = mask_zero

        self.W_constraint = constraints.get(W_constraint)
        self.constraints = [self.W_constraint]

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

        self.initial_weights = weights
        kwargs['input_shape'] = (self.input_dim,)
        super(FixedEmbedding, self).__init__(**kwargs) 
开发者ID:UKPLab,项目名称:deeplearning4nlp-tutorial,代码行数:20,代码来源:FixedEmbedding.py

示例9: __init__

# 需要导入模块: from keras import initializations [as 别名]
# 或者: from keras.initializations import get [as 别名]
def __init__(self, output_dim, init='glorot_uniform', activation='linear', weights=None,
                 W_regularizer=None, b_regularizer=None, activity_regularizer=None,
                 W_constraint=None, b_constraint=None, input_dim=None, **kwargs):
        self.init = initializations.get(init)
        self.activation = activations.get(activation)
        self.output_dim = output_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.constraints = [self.W_constraint, self.b_constraint]

        self.initial_weights = weights

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

示例10: __init__

# 需要导入模块: from keras import initializations [as 别名]
# 或者: from keras.initializations import get [as 别名]
def __init__(self, nb_filter, stack_size, filter_length,
                 init='glorot_uniform', activation='linear', weights=None,
                 image_shape=None, border_mode='valid', subsample_length=1):
        super(Convolution1D, self).__init__()

        nb_row = 1
        nb_col = filter_length
        subsample = (1,subsample_length)
        self.init = initializations.get(init)
        self.activation = activations.get(activation)
        self.subsample = subsample
        self.border_mode = border_mode
        self.image_shape = image_shape
        self.nb_filter = nb_filter
        self.stack_size = stack_size

        self.input = T.tensor4()
        self.W_shape = (nb_filter, stack_size, nb_row, nb_col)
        self.W = self.init(self.W_shape)
        self.b = shared_zeros((nb_filter,))

        self.params = [self.W, self.b]

        if weights is not None:
            self.set_weights(weights) 
开发者ID:jramapuram,项目名称:LSTM_Anomaly_Detector,代码行数:27,代码来源:convolutional.py

示例11: __init__

# 需要导入模块: from keras import initializations [as 别名]
# 或者: from keras.initializations import get [as 别名]
def __init__(self, downsampling_factor=10, init='glorot_uniform', activation='linear',
                 weights=None, W_regularizer=None, activity_regularizer=None,
                 W_constraint=None, input_dim=None, **kwargs):

        self.downsampling_factor = downsampling_factor
        self.init = initializations.get(init)
        self.activation = activations.get(activation)

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

        self.W_constraint = constraints.get(W_constraint)

        self.initial_weights = weights

        self.input_dim = input_dim
        if self.input_dim:
            kwargs['input_shape'] = (self.input_dim,)

        self.input_spec = [InputSpec(ndim=4)]
        super(EltWiseProduct, self).__init__(**kwargs) 
开发者ID:marcellacornia,项目名称:mlnet,代码行数:23,代码来源:eltwise_product.py

示例12: __init__

# 需要导入模块: from keras import initializations [as 别名]
# 或者: from keras.initializations 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(DualCurrent, self).__init__(**kwargs) 
开发者ID:braingineer,项目名称:ikelos,代码行数:22,代码来源:rtn.py

示例13: __init__

# 需要导入模块: from keras import initializations [as 别名]
# 或者: from keras.initializations import get [as 别名]
def __init__(self, nb_classes, frequency_table=None, mode=0, init='glorot_uniform', weights=None, W_regularizer=None, b_regularizer=None, activity_regularizer=None,
				 W_constraint=None, b_constraint=None,
				 bias=True, verbose=False, **kwargs):
		'''
		# Arguments:
		nb_classes: Number of classes.
		frequency_table: list. Frequency of each class. More frequent classes will have shorter huffman codes.
		mode: integer. One of [0, 1]
		verbose: boolean. Set to true to see the progress of building huffman tree. 
		'''
		self.nb_classes = nb_classes
		if frequency_table is None:
			frequency_table = [1] * nb_classes
		self.frequency_table = frequency_table
		self.mode = mode
		self.init = initializations.get(init)
		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.bias = bias
		self.initial_weights = weights
		self.verbose = verbose
		super(Huffmax, self).__init__(**kwargs) 
开发者ID:farizrahman4u,项目名称:huffmax,代码行数:27,代码来源:huffmax.py

示例14: __init__

# 需要导入模块: from keras import initializations [as 别名]
# 或者: from keras.initializations import get [as 别名]
def __init__(self, W_regularizer=None, b_regularizer=None,
                 W_constraint=None, b_constraint=None,
                 bias=True, **kwargs):
        """
        Keras Layer that implements an Content Attention mechanism.
        Supports Masking.
        """
        self.supports_masking = True
        self.init = initializations.get('glorot_uniform')

        self.W_regularizer = regularizers.get(W_regularizer)
        self.b_regularizer = regularizers.get(b_regularizer)
        self.W_constraint = constraints.get(W_constraint)
        self.b_constraint = constraints.get(b_constraint)

        self.bias = bias
        super(Attention, self).__init__(**kwargs) 
开发者ID:ruidan,项目名称:Unsupervised-Aspect-Extraction,代码行数:19,代码来源:my_layers.py

示例15: __init__

# 需要导入模块: from keras import initializations [as 别名]
# 或者: from keras.initializations import get [as 别名]
def __init__(self, nb_filter, nb_row, nb_col,
        init='glorot_uniform', activation='linear', weights=None,
        border_mode='valid', subsample=(1, 1),
        W_regularizer=None, b_regularizer=None, activity_regularizer=None, 
        W_constraint=None, b_constraint=None, **kwargs):
    
        if border_mode not in {'valid', 'full', 'same'}:
            raise Exception('Invalid border mode for TimeDistributedConvolution2D:', border_mode)

        self.nb_filter = nb_filter
        self.nb_row = nb_row
        self.nb_col = nb_col
        self.init = initializations.get(init)
        self.activation = activations.get(activation)
        self.border_mode = border_mode
        self.subsample = tuple(subsample)

        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.constraints = [self.W_constraint, self.b_constraint]

        self.initial_weights = weights
        super(TimeDistributedConvolution2D,self).__init__(**kwargs) 
开发者ID:textclf,项目名称:fancy-cnn,代码行数:29,代码来源:convolutions.py


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