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

Method __init__

pycontrast/networks/resnet.py:43–59  ·  view source on GitHub ↗
(self, inplanes, planes, stride=1, downsample=None, groups=1,
                 base_width=64, dilation=1, norm_layer=None)

Source from the content-addressed store, hash-verified

41 expansion = 1
42
43 def __init__(self, inplanes, planes, stride=1, downsample=None, groups=1,
44 base_width=64, dilation=1, norm_layer=None):
45 super(BasicBlock, self).__init__()
46 if norm_layer is None:
47 norm_layer = nn.BatchNorm2d
48 if groups != 1 or base_width != 64:
49 raise ValueError('BasicBlock only supports groups=1 and base_width=64')
50 if dilation > 1:
51 raise NotImplementedError("Dilation > 1 not supported in BasicBlock")
52 # Both self.conv1 and self.downsample layers downsample the input when stride != 1
53 self.conv1 = conv3x3(inplanes, planes, stride)
54 self.bn1 = norm_layer(planes)
55 self.relu = nn.ReLU(inplace=True)
56 self.conv2 = conv3x3(planes, planes)
57 self.bn2 = norm_layer(planes)
58 self.downsample = downsample
59 self.stride = stride
60
61 def forward(self, x):
62 identity = x

Callers

nothing calls this directly

Calls 2

conv3x3Function · 0.70
__init__Method · 0.45

Tested by

no test coverage detected