(self, x)
| 446 | self.norm = None |
| 447 | |
| 448 | def forward(self, x): |
| 449 | B, C, H, W = x.shape |
| 450 | # FIXME look at relaxing size constraints |
| 451 | assert H == self.img_size[0] and W == self.img_size[1], \ |
| 452 | f"Input image size ({H}*{W}) doesn't match model ({self.img_size[0]}*{self.img_size[1]})." |
| 453 | x = self.proj(x).flatten(2).transpose(1, 2) # B Ph*Pw C |
| 454 | if self.norm is not None: |
| 455 | x = self.norm(x) |
| 456 | return x |
| 457 | |
| 458 | def flops(self): |
| 459 | Ho, Wo = self.patches_resolution |
nothing calls this directly
no outgoing calls
no test coverage detected