本文整理匯總了Python中lasagne.layers.MergeLayer方法的典型用法代碼示例。如果您正苦於以下問題:Python layers.MergeLayer方法的具體用法?Python layers.MergeLayer怎麽用?Python layers.MergeLayer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類lasagne.layers
的用法示例。
在下文中一共展示了layers.MergeLayer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from lasagne import layers [as 別名]
# 或者: from lasagne.layers import MergeLayer [as 別名]
def __init__(self, incoming, num_labels, mask_input=None, W=init.GlorotUniform(), b=init.Constant(0.), **kwargs):
# This layer inherits from a MergeLayer, because it can have two
# inputs - the layer input, and the mask.
# We will just provide the layer input as incomings, unless a mask input was provided.
self.input_shape = incoming.output_shape
incomings = [incoming]
self.mask_incoming_index = -1
if mask_input is not None:
incomings.append(mask_input)
self.mask_incoming_index = 1
super(CRFLayer, self).__init__(incomings, **kwargs)
self.num_labels = num_labels + 1
self.pad_label_index = num_labels
num_inputs = self.input_shape[2]
self.W = self.add_param(W, (num_inputs, self.num_labels, self.num_labels), name="W")
if b is None:
self.b = None
else:
self.b = self.add_param(b, (self.num_labels, self.num_labels), name="b", regularizable=False)
示例2: __init__
# 需要導入模塊: from lasagne import layers [as 別名]
# 或者: from lasagne.layers import MergeLayer [as 別名]
def __init__(self, incoming, num_labels, mask_input=None, W_h=init.GlorotUniform(), W_c=init.GlorotUniform(),
b=init.Constant(0.), **kwargs):
# This layer inherits from a MergeLayer, because it can have two
# inputs - the layer input, and the mask.
# We will just provide the layer input as incomings, unless a mask input was provided.
self.input_shape = incoming.output_shape
incomings = [incoming]
self.mask_incoming_index = -1
if mask_input is not None:
incomings.append(mask_input)
self.mask_incoming_index = 1
super(DepParserLayer, self).__init__(incomings, **kwargs)
self.num_labels = num_labels
num_inputs = self.input_shape[2]
# add parameters
self.W_h = self.add_param(W_h, (num_inputs, self.num_labels), name='W_h')
self.W_c = self.add_param(W_c, (num_inputs, self.num_labels), name='W_c')
if b is None:
self.b = None
else:
self.b = self.add_param(b, (self.num_labels,), name='b', regularizable=False)