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

Method __init__

imperative/python/test/integration/test_dtr.py:61–72  ·  view source on GitHub ↗
(self, block, num_blocks, num_classes=10)

Source from the content-addressed store, hash-verified

59
60class ResNet(M.Module):
61 def __init__(self, block, num_blocks, num_classes=10):
62 super(ResNet, self).__init__()
63 self.in_planes = 16
64
65 self.conv1 = M.Conv2d(3, 16, kernel_size=3, stride=1, padding=1, bias=False)
66 self.bn1 = M.BatchNorm2d(16)
67 self.layer1 = self._make_layer(block, 16, num_blocks[0], stride=1)
68 self.layer2 = self._make_layer(block, 32, num_blocks[1], stride=2)
69 self.layer3 = self._make_layer(block, 64, num_blocks[2], stride=2)
70 self.linear = M.Linear(64, num_classes)
71
72 self.apply(_weights_init)
73
74 def _make_layer(self, block, planes, num_blocks, stride):
75 strides = [stride] + [1] * (num_blocks - 1)

Callers 1

__init__Method · 0.45

Calls 2

_make_layerMethod · 0.95
applyMethod · 0.45

Tested by

no test coverage detected