(self, block, num_blocks, num_classes=10)
| 65 | |
| 66 | class ResNet(nn.Module): |
| 67 | def __init__(self, block, num_blocks, num_classes=10): |
| 68 | super(ResNet, self).__init__() |
| 69 | self.in_planes = 64 |
| 70 | |
| 71 | self.conv1 = conv3x3(3,64) |
| 72 | self.bn1 = nn.BatchNorm2d(64) |
| 73 | self.layer1 = self._make_layer(block, 64, num_blocks[0], stride=1) |
| 74 | self.layer2 = self._make_layer(block, 128, num_blocks[1], stride=2) |
| 75 | self.layer3 = self._make_layer(block, 256, num_blocks[2], stride=2) |
| 76 | self.layer4 = self._make_layer(block, 512, num_blocks[3], stride=2) |
| 77 | self.linear = nn.Linear(512*block.expansion, num_classes) |
| 78 | |
| 79 | def _make_layer(self, block, planes, num_blocks, stride): |
| 80 | strides = [stride] + [1]*(num_blocks-1) |
no test coverage detected