From 0a9c2607a0eec7287fe3299f5580f3fdb9ebed86 Mon Sep 17 00:00:00 2001 From: Fredo Guan Date: Thu, 12 Jan 2023 11:10:48 -0800 Subject: [PATCH] Update metaformers.py --- timm/models/metaformers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/timm/models/metaformers.py b/timm/models/metaformers.py index 921a33cc..1a074944 100644 --- a/timm/models/metaformers.py +++ b/timm/models/metaformers.py @@ -731,6 +731,10 @@ class MetaFormer(nn.Module): def reset_classifier(self, num_classes=0, global_pool=None): + if global_pool is not None: + self.global_pool = SelectAdaptivePool2d(pool_type=global_pool) + + if num_classes == 0: self.head = nn.Identity() self.norm = nn.Identity()