(self, x)
| 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 | |
| 333 | def inflate_weight(weight_2d, time_dim, center=True): |
nothing calls this directly
no outgoing calls
no test coverage detected