(self, x)
| 954 | pass |
| 955 | |
| 956 | def forward_features(self, x): |
| 957 | x = self.patch_embed(x) |
| 958 | _, H, W, _ = x.shape |
| 959 | for layer in self.layers: |
| 960 | x = layer(x, (H, W)) |
| 961 | H = x.shape[1] |
| 962 | # print(x.shape) # nhwc |
| 963 | x = self.norm(x) |
| 964 | x = x.permute(0, 2, 3, 1).contiguous() # nwch |
| 965 | x = self.pooling(x) |
| 966 | x = x.squeeze(3) # .reshape(b, W, -1) |
| 967 | x = self.mlp_head(x) |
| 968 | |
| 969 | return x |
| 970 | |
| 971 | def forward(self, x): |
| 972 | x = self.forward_features(x) |