MCPcopy Create free account
hub / github.com/OpenGVLab/UniFormerV2 / forward

Method forward

slowfast/models/uniformerv2_model.py:319–330  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

317 )
318
319 def forward(self, x):
320 x = self.conv1(x) # shape = [*, width, grid, grid]
321 N, C, T, H, W = x.shape
322 x = x.permute(0, 2, 3, 4, 1).reshape(N * T, H * W, C)
323
324 x = torch.cat([self.class_embedding.to(x.dtype) + torch.zeros(x.shape[0], 1, x.shape[-1], dtype=x.dtype, device=x.device), x], dim=1) # shape = [*, grid ** 2 + 1, width]
325 x = x + self.positional_embedding.to(x.dtype)
326 x = self.ln_pre(x)
327
328 x = x.permute(1, 0, 2) # NLD -> LND
329 out = self.transformer(x)
330 return out
331
332
333def inflate_weight(weight_2d, time_dim, center=True):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected