MCPcopy
hub / github.com/HobbitLong/SupContrast / __init__

Method __init__

networks/resnet_big.py:45–60  ·  view source on GitHub ↗
(self, in_planes, planes, stride=1, is_last=False)

Source from the content-addressed store, hash-verified

43 expansion = 4
44
45 def __init__(self, in_planes, planes, stride=1, is_last=False):
46 super(Bottleneck, self).__init__()
47 self.is_last = is_last
48 self.conv1 = nn.Conv2d(in_planes, planes, kernel_size=1, bias=False)
49 self.bn1 = nn.BatchNorm2d(planes)
50 self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, stride=stride, padding=1, bias=False)
51 self.bn2 = nn.BatchNorm2d(planes)
52 self.conv3 = nn.Conv2d(planes, self.expansion * planes, kernel_size=1, bias=False)
53 self.bn3 = nn.BatchNorm2d(self.expansion * planes)
54
55 self.shortcut = nn.Sequential()
56 if stride != 1 or in_planes != self.expansion * planes:
57 self.shortcut = nn.Sequential(
58 nn.Conv2d(in_planes, self.expansion * planes, kernel_size=1, stride=stride, bias=False),
59 nn.BatchNorm2d(self.expansion * planes)
60 )
61
62 def forward(self, x):
63 out = F.relu(self.bn1(self.conv1(x)))

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected