MCPcopy Create free account
hub / github.com/HobbitLong/PyContrast / __init__

Method __init__

pycontrast/networks/resnest.py:22–50  ·  view source on GitHub ↗
(self, in_channels, channels, kernel_size, stride=(1, 1), padding=(0, 0),
                 dilation=(1, 1), groups=1, bias=True,
                 radix=2, reduction_factor=4,
                 rectify=False, rectify_avg=False, norm_layer=None,
                 dropblock_prob=0.0, **kwargs)

Source from the content-addressed store, hash-verified

20 """Split-Attention Conv2d
21 """
22 def __init__(self, in_channels, channels, kernel_size, stride=(1, 1), padding=(0, 0),
23 dilation=(1, 1), groups=1, bias=True,
24 radix=2, reduction_factor=4,
25 rectify=False, rectify_avg=False, norm_layer=None,
26 dropblock_prob=0.0, **kwargs):
27 super(SplAtConv2d, self).__init__()
28 padding = _pair(padding)
29 self.rectify = rectify and (padding[0] > 0 or padding[1] > 0)
30 self.rectify_avg = rectify_avg
31 inter_channels = max(in_channels*radix//reduction_factor, 32)
32 self.radix = radix
33 self.cardinality = groups
34 self.channels = channels
35 self.dropblock_prob = dropblock_prob
36 if self.rectify:
37 from rfconv import RFConv2d
38 self.conv = RFConv2d(in_channels, channels*radix, kernel_size, stride, padding, dilation,
39 groups=groups*radix, bias=bias, average_mode=rectify_avg, **kwargs)
40 else:
41 self.conv = Conv2d(in_channels, channels*radix, kernel_size, stride, padding, dilation,
42 groups=groups*radix, bias=bias, **kwargs)
43 self.use_bn = norm_layer is not None
44 self.bn0 = norm_layer(channels*radix)
45 self.relu = ReLU(inplace=True)
46 self.fc1 = Conv2d(channels, inter_channels, 1, groups=self.cardinality)
47 self.bn1 = norm_layer(inter_channels)
48 self.fc2 = Conv2d(inter_channels, channels*radix, 1, groups=self.cardinality)
49 if dropblock_prob > 0.0:
50 self.dropblock = DropBlock2D(dropblock_prob, 3)
51
52 def forward(self, x):
53 x = self.conv(x)

Callers

nothing calls this directly

Calls 2

DropBlock2DClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected