(self, x)
| 36 | nn.Linear(channel // reduction, channel), nn.Sigmoid()) |
| 37 | |
| 38 | def forward(self, x): |
| 39 | |
| 40 | def _inner_forward(x): |
| 41 | num_batch, num_channel = x.size()[:2] |
| 42 | y = self.avg_pool(x).view(num_batch, num_channel) |
| 43 | y = self.fc(y).view(num_batch, num_channel, 1, 1) |
| 44 | return x * y |
| 45 | |
| 46 | if self.with_cp and x.requires_grad: |
| 47 | out = cp.checkpoint(_inner_forward, x) |
| 48 | else: |
| 49 | out = _inner_forward(x) |
| 50 | |
| 51 | return out |
| 52 | |
| 53 | |
| 54 | class ContextGuidedBlock(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected