| 74 | expansion = 4 |
| 75 | |
| 76 | def __init__(self, inplanes, planes, stride=1, downsample=None): |
| 77 | super(Bottleneck, self).__init__() |
| 78 | self.conv1 = layer.Conv2d(inplanes, planes, 1, bias=False) |
| 79 | self.bn1 = layer.BatchNorm2d(planes) |
| 80 | self.relu1 = layer.ReLU() |
| 81 | self.conv2 = layer.Conv2d(planes, |
| 82 | planes, |
| 83 | 3, |
| 84 | stride=stride, |
| 85 | padding=1, |
| 86 | bias=False) |
| 87 | self.bn2 = layer.BatchNorm2d(planes) |
| 88 | self.relu2 = layer.ReLU() |
| 89 | self.conv3 = layer.Conv2d(planes, |
| 90 | planes * self.expansion, |
| 91 | 1, |
| 92 | bias=False) |
| 93 | self.bn3 = layer.BatchNorm2d(planes * self.expansion) |
| 94 | |
| 95 | self.add = layer.Add() |
| 96 | self.relu3 = layer.ReLU() |
| 97 | |
| 98 | self.downsample = downsample |
| 99 | self.stride = stride |
| 100 | |
| 101 | def forward(self, x): |
| 102 | residual = x |