(self, x)
| 971 | |
| 972 | @torch.inference_mode() |
| 973 | def encode(self, x): |
| 974 | # b (nc cf) c h w -> (b nc) cf c h w -> encode -> (b nc) cf c h w -> b (nc cf) c h w |
| 975 | chunks = list(x.split(self.frame_len, dim=1)) |
| 976 | for i in range(len(chunks)): |
| 977 | chunks[i] = self.naive_encode(chunks[i], True) |
| 978 | z = torch.cat(chunks, dim=1) |
| 979 | |
| 980 | posterior = DiagonalGaussianDistribution(z) |
| 981 | return posterior.sample() |
| 982 | |
| 983 | def decode_naive(self, z, is_init=True): |
| 984 | z = z.to(next(self.decoder.parameters()).dtype) |
nothing calls this directly
no test coverage detected