(self, x, hw_shape)
| 278 | self.with_cp = with_cp |
| 279 | |
| 280 | def forward(self, x, hw_shape): |
| 281 | def _inner_forward(x): |
| 282 | x = self.attn(self.norm1(x), hw_shape, identity=x) |
| 283 | x = self.ffn(self.norm2(x), hw_shape, identity=x) |
| 284 | return x |
| 285 | |
| 286 | if self.with_cp and x.requires_grad: |
| 287 | x = cp.checkpoint(_inner_forward, x) |
| 288 | else: |
| 289 | x = _inner_forward(x) |
| 290 | return x |
| 291 | |
| 292 | |
| 293 | @BACKBONES.register_module() |
nothing calls this directly
no outgoing calls
no test coverage detected