(self, x)
| 47 | |
| 48 | |
| 49 | def encode(self, x): |
| 50 | h = self.encoder(x) |
| 51 | z = self.quant_conv(h) |
| 52 | latent_ch = z.shape[1] |
| 53 | latent_t = z.shape[2] |
| 54 | dtype = z.dtype |
| 55 | mean = self.latent_mean.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=dtype, device=z.device) |
| 56 | std = self.latent_std.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=dtype, device=z.device) |
| 57 | return ((z - mean) / std) * self.sigma_data |
| 58 | |
| 59 | def decode(self, z): |
| 60 | in_dtype = z.dtype |
no test coverage detected