本文整理汇总了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)
示例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)
示例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)
示例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)
示例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]
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)