x: (N, T, patch_size**2 * C) imgs: (N, H, W, C)
(self, x)
| 872 | pass |
| 873 | |
| 874 | def unpatchify(self, x): |
| 875 | """ |
| 876 | x: (N, T, patch_size**2 * C) |
| 877 | imgs: (N, H, W, C) |
| 878 | """ |
| 879 | c = self.out_channels |
| 880 | p = self.x_embedder.patch_size[0] |
| 881 | h = w = int(x.shape[1] ** 0.5) |
| 882 | assert h * w == x.shape[1] |
| 883 | |
| 884 | x = x.reshape(shape=(x.shape[0], h, w, p, p, c)) |
| 885 | x = torch.einsum("nhwpqc->nchpwq", x) |
| 886 | imgs = x.reshape(shape=(x.shape[0], c, h * p, h * p)) |
| 887 | return imgs |
| 888 | |
| 889 | def unpatchify_video(self, x, video_frames): |
| 890 | """ |