MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / __init__

Method __init__

imperative/python/test/integration/test_dtr.py:29–50  ·  view source on GitHub ↗
(self, in_planes, planes, stride=1)

Source from the content-addressed store, hash-verified

27 expansion = 1
28
29 def __init__(self, in_planes, planes, stride=1):
30 super(BasicBlock, self).__init__()
31 self.conv1 = M.Conv2d(
32 in_planes, planes, kernel_size=3, stride=stride, padding=1, bias=False
33 )
34 self.bn1 = M.BatchNorm2d(planes)
35 self.conv2 = M.Conv2d(
36 planes, planes, kernel_size=3, stride=1, padding=1, bias=False
37 )
38 self.bn2 = M.BatchNorm2d(planes)
39 self.shortcut = M.Sequential()
40 if stride != 1 or in_planes != planes:
41 self.shortcut = M.Sequential(
42 M.Conv2d(
43 in_planes,
44 self.expansion * planes,
45 kernel_size=1,
46 stride=stride,
47 bias=False,
48 ),
49 M.BatchNorm2d(self.expansion * planes),
50 )
51
52 def forward(self, x):
53 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