MCPcopy Create free account
hub / github.com/alinlab/SelfPatch / forward

Method forward

segmentation/backbones/swin.py:354–374  ·  view source on GitHub ↗
(self, x, hw_shape)

Source from the content-addressed store, hash-verified

352 init_cfg=None)
353
354 def forward(self, x, hw_shape):
355
356 def _inner_forward(x):
357 identity = x
358 x = self.norm1(x)
359 x = self.attn(x, hw_shape)
360
361 x = x + identity
362
363 identity = x
364 x = self.norm2(x)
365 x = self.ffn(x, identity=identity)
366
367 return x
368
369 if self.with_cp and x.requires_grad:
370 x = cp.checkpoint(_inner_forward, x)
371 else:
372 x = _inner_forward(x)
373
374 return x
375
376
377class SwinBlockSequence(BaseModule):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected