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


Python ParameterTags.WEIGHT属性代码示例

本文整理汇总了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) 
开发者ID:yihui-he,项目名称:KL-Loss,代码行数:27,代码来源:detector.py


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