Update metaformers.py

pull/1647/head
Fredo Guan 2 years ago
parent ee16588a3a
commit 116345b4d3

@ -627,10 +627,11 @@ class MetaFormer(nn.Module):
return {'norm'}
def forward_features(self, x):
for i in range(self.num_stage):
x = self.downsample_layers[i](x)
x = self.stages[i](x)
return self.norm(x.mean([1, 2])) # (B, H, W, C) -> (B, C)
x = self.stages(x)
x = x.mean([1,2]) # TODO use adaptive pool instead of mean
x = self.norm(x)
# (B, H, W, C) -> (B, C)
return x
def forward(self, x):
x = self.forward_features(x)

Loading…
Cancel
Save