Update metaformers.py

This commit is contained in:
Fredo Guan 2023-02-05 02:03:34 -08:00
parent 53b8ce5b8a
commit a2329ab8ec

View File

@ -584,7 +584,7 @@ class MetaFormer(nn.Module):
# NOTE nn.Sequential in head broken down since can't call head[:-1](x) in torchscript :( # NOTE nn.Sequential in head broken down since can't call head[:-1](x) in torchscript :(
x = self.head.global_pool(x.permute(0, 3, 1, 2)) x = self.head.global_pool(x.permute(0, 3, 1, 2))
x = self.head.flatten(x) x = self.head.flatten(x)
x = self.head.norm(x.permute(0, 2, 3, 1)) x = self.head.norm(x)
return x if pre_logits else self.head.fc(x) return x if pre_logits else self.head.fc(x)
def forward_features(self, x): def forward_features(self, x):