MCPcopy Create free account
hub / github.com/QWTforGithub/T2LDM / reset_classifier

Method reset_classifier

timm/models/ghostnet.py:190–195  ·  view source on GitHub ↗
(self, num_classes, global_pool='avg')

Source from the content-addressed store, hash-verified

188 return self.classifier
189
190 def reset_classifier(self, num_classes, global_pool='avg'):
191 self.num_classes = num_classes
192 # cannot meaningfully change pooling of efficient head after creation
193 self.global_pool = SelectAdaptivePool2d(pool_type=global_pool)
194 self.flatten = nn.Flatten(1) if global_pool else nn.Identity() # don't flatten if pooling disabled
195 self.classifier = Linear(self.pool_dim, num_classes) if num_classes > 0 else nn.Identity()
196
197 def forward_features(self, x):
198 x = self.conv_stem(x)

Callers

nothing calls this directly

Calls 2

LinearClass · 0.85

Tested by

no test coverage detected