MCPcopy Create free account
hub / github.com/CausalLearning/robust-unlearnable-examples / __init__

Method __init__

models/resnet.py:13–26  ·  view source on GitHub ↗
(self, in_planes, planes, stride=1, wide=1)

Source from the content-addressed store, hash-verified

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