MCPcopy Create free account
hub / github.com/Inception3D/TTT3R / forward

Method forward

src/dust3r/patch_embed.py:19–32  ·  view source on GitHub ↗
(self, x, **kw)

Source from the content-addressed store, hash-verified

17
18class PatchEmbedDust3R(PatchEmbed):
19 def forward(self, x, **kw):
20 B, C, H, W = x.shape
21 assert (
22 H % self.patch_size[0] == 0
23 ), f"Input image height ({H}) is not a multiple of patch size ({self.patch_size[0]})."
24 assert (
25 W % self.patch_size[1] == 0
26 ), f"Input image width ({W}) is not a multiple of patch size ({self.patch_size[1]})."
27 x = self.proj(x)
28 pos = self.position_getter(B, x.size(2), x.size(3), x.device)
29 if self.flatten:
30 x = x.flatten(2).transpose(1, 2) # BCHW -> BNC
31 x = self.norm(x)
32 return x, pos
33
34
35class ManyAR_PatchEmbed(PatchEmbed):

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected