(self, in_dim, reduction_dim, bins, BatchNorm)
| 8 | |
| 9 | class PPM(nn.Module): |
| 10 | def __init__(self, in_dim, reduction_dim, bins, BatchNorm): |
| 11 | super(PPM, self).__init__() |
| 12 | self.features = [] |
| 13 | for bin in bins: |
| 14 | self.features.append(nn.Sequential( |
| 15 | nn.AdaptiveAvgPool2d(bin), |
| 16 | nn.Conv2d(in_dim, reduction_dim, kernel_size=1, bias=False), |
| 17 | BatchNorm(reduction_dim), |
| 18 | nn.ReLU(inplace=True) |
| 19 | )) |
| 20 | self.features = nn.ModuleList(self.features) |
| 21 | |
| 22 | def forward(self, x): |
| 23 | x_size = x.size() |