(self, channel, reduction=16, with_cp=False)
| 25 | """ |
| 26 | |
| 27 | def __init__(self, channel, reduction=16, with_cp=False): |
| 28 | super(GlobalContextExtractor, self).__init__() |
| 29 | self.channel = channel |
| 30 | self.reduction = reduction |
| 31 | assert reduction >= 1 and channel >= reduction |
| 32 | self.with_cp = with_cp |
| 33 | self.avg_pool = nn.AdaptiveAvgPool2d(1) |
| 34 | self.fc = nn.Sequential( |
| 35 | nn.Linear(channel, channel // reduction), nn.ReLU(inplace=True), |
| 36 | nn.Linear(channel // reduction, channel), nn.Sigmoid()) |
| 37 | |
| 38 | def forward(self, x): |
| 39 |