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

Method __init__

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

Source from the content-addressed store, hash-verified

37 expansion = 4
38
39 def __init__(self, in_planes, planes, stride=1, wide=1):
40 super(Bottleneck, self).__init__()
41 mid_planes = planes * wide
42 self.conv1 = nn.Conv2d(in_planes, mid_planes, kernel_size=1, bias=False)
43 self.bn1 = nn.BatchNorm2d(mid_planes)
44 self.conv2 = nn.Conv2d(mid_planes, mid_planes, kernel_size=3, stride=stride, padding=1, bias=False)
45 self.bn2 = nn.BatchNorm2d(mid_planes)
46 self.conv3 = nn.Conv2d(mid_planes, self.expansion*planes, kernel_size=1, bias=False)
47 self.bn3 = nn.BatchNorm2d(self.expansion*planes)
48
49 self.shortcut = nn.Sequential()
50 if stride != 1 or in_planes != self.expansion*planes:
51 self.shortcut = nn.Sequential(
52 nn.Conv2d(in_planes, self.expansion*planes, kernel_size=1, stride=stride, bias=False),
53 nn.BatchNorm2d(self.expansion*planes)
54 )
55
56 def forward(self, x):
57 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