(self, x)
| 34 | self.fc_select = nn.Conv2d(attn_channels, channels * num_paths, kernel_size=1, bias=False) |
| 35 | |
| 36 | def forward(self, x): |
| 37 | assert x.shape[1] == self.num_paths |
| 38 | x = x.sum(1).mean((2, 3), keepdim=True) |
| 39 | x = self.fc_reduce(x) |
| 40 | x = self.bn(x) |
| 41 | x = self.act(x) |
| 42 | x = self.fc_select(x) |
| 43 | B, C, H, W = x.shape |
| 44 | x = x.view(B, self.num_paths, C // self.num_paths, H, W) |
| 45 | x = torch.softmax(x, dim=1) |
| 46 | return x |
| 47 | |
| 48 | |
| 49 | class SelectiveKernel(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected