本文整理汇总了Python中caffe2.python.modeling.parameter_info.ParameterTags.WEIGHT属性的典型用法代码示例。如果您正苦于以下问题:Python ParameterTags.WEIGHT属性的具体用法?Python ParameterTags.WEIGHT怎么用?Python ParameterTags.WEIGHT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类caffe2.python.modeling.parameter_info.ParameterTags
的用法示例。
在下文中一共展示了ParameterTags.WEIGHT属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AffineChannel
# 需要导入模块: from caffe2.python.modeling.parameter_info import ParameterTags [as 别名]
# 或者: from caffe2.python.modeling.parameter_info.ParameterTags import WEIGHT [as 别名]
def AffineChannel(self, blob_in, blob_out, dim, inplace=False):
"""Affine transformation to replace BN in networks where BN cannot be
used (e.g., because the minibatch size is too small).
The operations can be done in place to save memory.
"""
blob_out = blob_out or self.net.NextName()
param_prefix = blob_out
scale = self.create_param(
param_name=param_prefix + '_s',
initializer=initializers.Initializer("ConstantFill", value=1.),
tags=ParameterTags.WEIGHT,
shape=[dim, ],
)
bias = self.create_param(
param_name=param_prefix + '_b',
initializer=initializers.Initializer("ConstantFill", value=0.),
tags=ParameterTags.BIAS,
shape=[dim, ],
)
if inplace:
return self.net.AffineChannel([blob_in, scale, bias], blob_in)
else:
return self.net.AffineChannel([blob_in, scale, bias], blob_out)