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

Method __init__

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

Source from the content-addressed store, hash-verified

13 expansion = 1
14
15 def __init__(self, in_planes, planes, stride=1, is_last=False):
16 super(BasicBlock, self).__init__()
17 self.is_last = is_last
18 self.conv1 = nn.Conv2d(in_planes, planes, kernel_size=3, stride=stride, padding=1, bias=False)
19 self.bn1 = nn.BatchNorm2d(planes)
20 self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, stride=1, padding=1, bias=False)
21 self.bn2 = nn.BatchNorm2d(planes)
22
23 self.shortcut = nn.Sequential()
24 if stride != 1 or in_planes != self.expansion * planes:
25 self.shortcut = nn.Sequential(
26 nn.Conv2d(in_planes, self.expansion * planes, kernel_size=1, stride=stride, bias=False),
27 nn.BatchNorm2d(self.expansion * planes)
28 )
29
30 def forward(self, x):
31 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