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

Method forward_features

timm/models/pit.py:222–231  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

220 self.head_dist = nn.Linear(self.embed_dim, self.num_classes) if num_classes > 0 else nn.Identity()
221
222 def forward_features(self, x):
223 x = self.patch_embed(x)
224 x = self.pos_drop(x + self.pos_embed)
225 cls_tokens = self.cls_token.expand(x.shape[0], -1, -1)
226 x, cls_tokens = self.transformers((x, cls_tokens))
227 cls_tokens = self.norm(cls_tokens)
228 if self.head_dist is not None:
229 return cls_tokens[:, 0], cls_tokens[:, 1]
230 else:
231 return cls_tokens[:, 0]
232
233 def forward(self, x):
234 x = self.forward_features(x)

Callers 1

forwardMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected