x: (N, T, patch_size**2 * C) imgs: (N, H, W, C)
(self, x, h, w)
| 411 | nn.init.constant_(self.final_layer.linear.bias, 0) |
| 412 | |
| 413 | def unpatchify(self, x, h, w): |
| 414 | """ |
| 415 | x: (N, T, patch_size**2 * C) |
| 416 | imgs: (N, H, W, C) |
| 417 | """ |
| 418 | c = self.out_channels |
| 419 | |
| 420 | x = x.reshape(shape=(x.shape[0], h//self.patch_size, w//self.patch_size, self.patch_size, self.patch_size, c)) |
| 421 | x = torch.einsum('nhwpqc->nchpwq', x) |
| 422 | imgs = x.reshape(shape=(x.shape[0], c, h, w)) |
| 423 | return imgs |
| 424 | |
| 425 | |
| 426 | def cropped_pos_embed(self, height, width): |