MCPcopy Create free account
hub / github.com/UX-Decoder/Semantic-SAM / forward

Method forward

semantic_sam/backbone/swin.py:810–825  ·  view source on GitHub ↗

Args: x: Tensor of shape (N,C,H,W). H, W must be a multiple of ``self.size_divisibility``. Returns: dict[str->Tensor]: names and the corresponding features

(self, x)

Source from the content-addressed store, hash-verified

808 }
809
810 def forward(self, x):
811 """
812 Args:
813 x: Tensor of shape (N,C,H,W). H, W must be a multiple of ``self.size_divisibility``.
814 Returns:
815 dict[str->Tensor]: names and the corresponding features
816 """
817 assert (
818 x.dim() == 4
819 ), f"SwinTransformer takes an input of shape (N, C, H, W). Got {x.shape} instead!"
820 outputs = {}
821 y = super().forward(x)
822 for k in y.keys():
823 if k in self._out_features:
824 outputs[k] = y[k]
825 return outputs
826
827 def output_shape(self):
828 feature_names = list(set(self._out_feature_strides.keys()) & set(self._out_features))

Callers

nothing calls this directly

Calls 1

forwardMethod · 0.45

Tested by

no test coverage detected