mirror of
https://github.com/huggingface/pytorch-image-models.git
synced 2025-06-03 15:01:08 +08:00
Update metaformers.py
This commit is contained in:
parent
ee16588a3a
commit
116345b4d3
@ -627,10 +627,11 @@ class MetaFormer(nn.Module):
|
|||||||
return {'norm'}
|
return {'norm'}
|
||||||
|
|
||||||
def forward_features(self, x):
|
def forward_features(self, x):
|
||||||
for i in range(self.num_stage):
|
x = self.stages(x)
|
||||||
x = self.downsample_layers[i](x)
|
x = x.mean([1,2]) # TODO use adaptive pool instead of mean
|
||||||
x = self.stages[i](x)
|
x = self.norm(x)
|
||||||
return self.norm(x.mean([1, 2])) # (B, H, W, C) -> (B, C)
|
# (B, H, W, C) -> (B, C)
|
||||||
|
return x
|
||||||
|
|
||||||
def forward(self, x):
|
def forward(self, x):
|
||||||
x = self.forward_features(x)
|
x = self.forward_features(x)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user