MCPcopy Create free account
hub / github.com/QWTforGithub/T2LDM / __init__

Method __init__

timm/models/sknet.py:49–73  ·  view source on GitHub ↗
(self, inplanes, planes, stride=1, downsample=None, cardinality=1, base_width=64,
                 sk_kwargs=None, reduce_first=1, dilation=1, first_dilation=None, act_layer=nn.ReLU,
                 norm_layer=nn.BatchNorm2d, attn_layer=None, aa_layer=None, drop_block=None, drop_path=None)

Source from the content-addressed store, hash-verified

47 expansion = 1
48
49 def __init__(self, inplanes, planes, stride=1, downsample=None, cardinality=1, base_width=64,
50 sk_kwargs=None, reduce_first=1, dilation=1, first_dilation=None, act_layer=nn.ReLU,
51 norm_layer=nn.BatchNorm2d, attn_layer=None, aa_layer=None, drop_block=None, drop_path=None):
52 super(SelectiveKernelBasic, self).__init__()
53
54 sk_kwargs = sk_kwargs or {}
55 conv_kwargs = dict(drop_block=drop_block, act_layer=act_layer, norm_layer=norm_layer, aa_layer=aa_layer)
56 assert cardinality == 1, 'BasicBlock only supports cardinality of 1'
57 assert base_width == 64, 'BasicBlock doest not support changing base width'
58 first_planes = planes // reduce_first
59 outplanes = planes * self.expansion
60 first_dilation = first_dilation or dilation
61
62 self.conv1 = SelectiveKernel(
63 inplanes, first_planes, stride=stride, dilation=first_dilation, **conv_kwargs, **sk_kwargs)
64 conv_kwargs['act_layer'] = None
65 self.conv2 = ConvBnAct(
66 first_planes, outplanes, kernel_size=3, dilation=dilation, **conv_kwargs)
67 self.se = create_attn(attn_layer, outplanes)
68 self.act = act_layer(inplace=True)
69 self.downsample = downsample
70 self.stride = stride
71 self.dilation = dilation
72 self.drop_block = drop_block
73 self.drop_path = drop_path
74
75 def zero_init_last_bn(self):
76 nn.init.zeros_(self.conv2.bn.weight)

Callers 1

__init__Method · 0.45

Calls 3

SelectiveKernelClass · 0.85
create_attnFunction · 0.85
ConvBnActClass · 0.50

Tested by

no test coverage detected