(self, block, num_blocks, num_classes=10)
| 59 | |
| 60 | class 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) |
no test coverage detected