| 126 | return x.mean([2, 3]) |
| 127 | |
| 128 | class GlobalMaxPool2d(nn.Module): |
| 129 | def __init__(self): |
| 130 | super().__init__() |
| 131 | |
| 132 | def forward(self, x): |
| 133 | return x.max(dim=2)[0].max(dim=2)[0] |
| 134 | |
| 135 | class AdaptiveAvgMaxPool2d(nn.Module): |
| 136 | def __init__(self): |