本文整理汇总了Python中chainer.initializers.HeUniform方法的典型用法代码示例。如果您正苦于以下问题:Python initializers.HeUniform方法的具体用法?Python initializers.HeUniform怎么用?Python initializers.HeUniform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chainer.initializers
的用法示例。
在下文中一共展示了initializers.HeUniform方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_initializer
# 需要导入模块: from chainer import initializers [as 别名]
# 或者: from chainer.initializers import HeUniform [as 别名]
def create_initializer(init_type, scale=None, fillvalue=None):
if init_type == 'identity':
return initializers.Identity() if scale is None else initializers.Identity(scale=scale)
if init_type == 'constant':
return initializers.Constant(fillvalue)
if init_type == 'zero':
return initializers.Zero()
if init_type == 'one':
return initializers.One()
if init_type == 'normal':
return initializers.Normal() if scale is None else initializers.Normal(scale)
if init_type == 'glorotNormal':
return initializers.GlorotNormal() if scale is None else initializers.GlorotNormal(scale)
if init_type == 'heNormal':
return initializers.HeNormal() if scale is None else initializers.HeNormal(scale)
if init_type == 'orthogonal':
return initializers.Orthogonal(
scale) if scale is None else initializers.Orthogonal(scale)
if init_type == 'uniform':
return initializers.Uniform(
scale) if scale is None else initializers.Uniform(scale)
if init_type == 'leCunUniform':
return initializers.LeCunUniform(
scale) if scale is None else initializers.LeCunUniform(scale)
if init_type == 'glorotUniform':
return initializers.GlorotUniform(
scale) if scale is None else initializers.GlorotUniform(scale)
if init_type == 'heUniform':
return initializers.HeUniform(
scale) if scale is None else initializers.HeUniform(scale)
raise ValueError("Unknown initializer type: {0}".format(init_type))
示例2: _build_model
# 需要导入模块: from chainer import initializers [as 别名]
# 或者: from chainer.initializers import HeUniform [as 别名]
def _build_model(self):
initializer = HeUniform()
in_shape = self.input_shape[0]
return [L.Convolution2D(in_shape, 64, ksize=4, stride=2,
initialW=initializer),
L.Convolution2D(64, 64, ksize=3, stride=1,
initialW=initializer),
L.Linear(None, 512, initialW=HeUniform(0.1)),
L.Linear(512, self.output_shape, initialW=HeUniform(0.1))]
示例3: __init__
# 需要导入模块: from chainer import initializers [as 别名]
# 或者: from chainer.initializers import HeUniform [as 别名]
def __init__(self, adj, labels, feat_size, dropout=0.5):
super(TextGCN, self).__init__()
n_class = np.max(labels) + 1
initializer = initializers.HeUniform()
with self.init_scope():
self.gconv1 = GraphConvolution(adj.shape[1], feat_size)
self.gconv2 = GraphConvolution(feat_size, n_class)
# This Variable will not be updated because require_grad=False
self.input = to_chainer_sparse_variable(
sp.identity(adj.shape[1]))
self.adj = adj
self.labels = labels
self.dropout = dropout