(
self, x: torch.Tensor, return_dict: bool = True
)
| 181 | |
| 182 | @apply_forward_hook |
| 183 | def encode( |
| 184 | self, x: torch.Tensor, return_dict: bool = True |
| 185 | ) -> Union[AutoencoderKLOutput, Tuple[DiagonalGaussianDistribution]]: |
| 186 | moments = self.encoder(x) |
| 187 | posterior = DiagonalGaussianDistribution(moments) |
| 188 | |
| 189 | if not return_dict: |
| 190 | return (posterior,) |
| 191 | |
| 192 | return AutoencoderKLOutput(latent_dist=posterior) |
| 193 | |
| 194 | @apply_forward_hook |
| 195 | def decode(self, z: torch.Tensor, interpolate=True, return_dict: bool = True) -> Union[DecoderOutput, Tuple[torch.Tensor]]: |
no outgoing calls
no test coverage detected