MCPcopy Create free account
hub / github.com/SLDGroup/MERIT / forward

Method forward

lib/models_timm/layers/patch_embed.py:40–48  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

38 self.norm = norm_layer(embed_dim) if norm_layer else nn.Identity()
39
40 def forward(self, x):
41 B, C, H, W = x.shape
42 _assert(H == self.img_size[0], f"Input image height ({H}) doesn't match model ({self.img_size[0]}).")
43 _assert(W == self.img_size[1], f"Input image width ({W}) doesn't match model ({self.img_size[1]}).")
44 x = self.proj(x)
45 if self.flatten:
46 x = x.flatten(2).transpose(1, 2) # BCHW -> BNC
47 x = self.norm(x)
48 return x

Callers

nothing calls this directly

Calls 1

_assertFunction · 0.85

Tested by

no test coverage detected