| 32 | num_layers = 2 |
| 33 | |
| 34 | def __init__(self, inplanes, planes, stride=1, downsample=None): |
| 35 | super(BasicBlock, self).__init__() |
| 36 | # only conv with possibly not 1 stride |
| 37 | self.conv1 = conv3x3(inplanes, planes, stride) |
| 38 | self.bn1 = nn.BatchNorm2d(planes) |
| 39 | self.relu = nn.ReLU(inplace=True) |
| 40 | self.conv2 = conv3x3(planes, planes) |
| 41 | self.bn2 = nn.BatchNorm2d(planes) |
| 42 | |
| 43 | # if stride is not 1 then self.downsample cannot be None |
| 44 | self.downsample = downsample |
| 45 | self.stride = stride |
| 46 | |
| 47 | def forward(self, x): |
| 48 | identity = x |