MCPcopy Create free account
hub / github.com/catalys1/mae-pytorch / forward

Method forward

mae.py:238–250  ·  view source on GitHub ↗
(self, x: torch.Tensor)

Source from the content-addressed store, hash-verified

236 return x
237
238 def forward(self, x: torch.Tensor):
239 x = self.forward_features(x)
240 x = self.project(x)
241
242 k = self.n - x.shape[1] # number of masked tokens
243 mask_toks = self.mask_token.expand(x.shape[0], k, -1)
244 x = torch.cat([x, mask_toks], 1)
245 x = self.select_tokens(x, self.idx.argsort(1))
246 x = x + self.pos_decoder
247 x = self.decoder(x)
248 x = self.pixel_project(x)
249
250 return x
251
252
253class MAE(pl.LightningModule):

Callers

nothing calls this directly

Calls 2

forward_featuresMethod · 0.95
select_tokensMethod · 0.95

Tested by

no test coverage detected