(
self,
features: Tensor,
)
| 87 | return x_out, loss, perplexity |
| 88 | |
| 89 | def encode( |
| 90 | self, |
| 91 | features: Tensor, |
| 92 | ) -> Union[Tensor, Distribution]: |
| 93 | |
| 94 | N, T, _ = features.shape |
| 95 | x_in = self.preprocess(features) |
| 96 | x_encoder = self.encoder(x_in) |
| 97 | x_encoder = self.postprocess(x_encoder) |
| 98 | x_encoder = x_encoder.contiguous().view(-1, |
| 99 | x_encoder.shape[-1]) # (NT, C) |
| 100 | code_idx = self.quantizer.quantize(x_encoder) |
| 101 | code_idx = code_idx.view(N, -1) |
| 102 | |
| 103 | # latent, dist |
| 104 | return code_idx, None |
| 105 | |
| 106 | def decode(self, z: Tensor): |
| 107 |
no test coverage detected