本文整理汇总了Python中nn.AffineChannel2d方法的典型用法代码示例。如果您正苦于以下问题:Python nn.AffineChannel2d方法的具体用法?Python nn.AffineChannel2d怎么用?Python nn.AffineChannel2d使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nn
的用法示例。
在下文中一共展示了nn.AffineChannel2d方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _init_modules
# 需要导入模块: import nn [as 别名]
# 或者: from nn import AffineChannel2d [as 别名]
def _init_modules(self):
assert cfg.RESNETS.FREEZE_AT in [0, 2, 3, 4, 5]
assert cfg.RESNETS.FREEZE_AT <= self.convX
for i in range(1, cfg.RESNETS.FREEZE_AT + 1):
freeze_params(getattr(self, 'res%d' % i))
# Freeze all bn (affine) layers !!!
self.apply(lambda m: freeze_params(m) if isinstance(m, mynn.AffineChannel2d) else None)
示例2: basic_bn_shortcut
# 需要导入模块: import nn [as 别名]
# 或者: from nn import AffineChannel2d [as 别名]
def basic_bn_shortcut(inplanes, outplanes, stride):
return nn.Sequential(
nn.Conv2d(inplanes,
outplanes,
kernel_size=1,
stride=stride,
bias=False),
mynn.AffineChannel2d(outplanes),
)
示例3: basic_bn_stem
# 需要导入模块: import nn [as 别名]
# 或者: from nn import AffineChannel2d [as 别名]
def basic_bn_stem():
return nn.Sequential(OrderedDict([
('conv1', nn.Conv2d(3, 64, 7, stride=2, padding=3, bias=False)),
('bn1', mynn.AffineChannel2d(64)),
('relu', nn.ReLU(inplace=True)),
# ('maxpool', nn.MaxPool2d(kernel_size=3, stride=2, padding=0, ceil_mode=True))]))
('maxpool', nn.MaxPool2d(kernel_size=3, stride=2, padding=1))]))
示例4: __init__
# 需要导入模块: import nn [as 别名]
# 或者: from nn import AffineChannel2d [as 别名]
def __init__(self, dim_in, roi_xform_func, spatial_scale):
super().__init__()
self.dim_in = dim_in
self.roi_xform = roi_xform_func
self.spatial_scale = spatial_scale
self.dim_out = cfg.MRCNN.DIM_REDUCED
self.res5, dim_out = ResNet_roi_conv5_head_for_masks(dim_in)
self.upconv5 = nn.ConvTranspose2d(dim_out, self.dim_out, 2, 2, 0)
# Freeze all bn (affine) layers in resnet!!!
self.res5.apply(
lambda m: ResNet.freeze_params(m)
if isinstance(m, mynn.AffineChannel2d) else None)
self._init_weights()