(self, x)
| 54 | self.norm = norm_layer(embed_dim) if norm_layer else nn.Identity() |
| 55 | |
| 56 | def forward(self, x): |
| 57 | B, C, H, W = x.shape |
| 58 | assert H == self.img_size[0] and W == self.img_size[1], \ |
| 59 | f"Input image size ({H}*{W}) doesn't match model ({self.img_size[0]}*{self.img_size[1]})." |
| 60 | x = self.proj(x) |
| 61 | if self.flatten: |
| 62 | x = x.flatten(2).transpose(1, 2) # BCHW -> BNC |
| 63 | x = self.norm(x) |
| 64 | return x |
| 65 | |
| 66 | |
| 67 | class Block(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected