| 25 | |
| 26 | |
| 27 | class Transition(nn.Module): |
| 28 | def __init__(self, in_planes, out_planes): |
| 29 | super(Transition, self).__init__() |
| 30 | self.bn = nn.BatchNorm2d(in_planes) |
| 31 | self.conv = nn.Conv2d(in_planes, out_planes, kernel_size=1, bias=False) |
| 32 | self.relu = nn.ReLU(inplace=False) |
| 33 | self.avgpool = nn.AvgPool2d(2) |
| 34 | |
| 35 | def forward(self, x): |
| 36 | out = self.conv(self.relu(self.bn(x))) |
| 37 | out = self.avgpool(out) |
| 38 | return out |
| 39 | |
| 40 | |
| 41 | class DenseNet(nn.Module): |