| 17 | |
| 18 | |
| 19 | class 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 | |
| 32 | class ManyAR_PatchEmbed (PatchEmbed): |
nothing calls this directly
no outgoing calls
no test coverage detected