MCPcopy Create free account
hub / github.com/NVlabs/InstantSplat / PatchEmbedDust3R

Class PatchEmbedDust3R

dust3r/patch_embed.py:19–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected