Method
encode
(
self, x: torch.Tensor, return_dict: bool = True
)
Source from the content-addressed store, hash-verified
| 808 | |
| 809 | @apply_forward_hook |
| 810 | def encode( |
| 811 | self, x: torch.Tensor, return_dict: bool = True |
| 812 | ) -> Union[AutoencoderKLOutput, Tuple[DiagonalGaussianDistribution]]: |
| 813 | h = self._encode(x) |
| 814 | |
| 815 | posterior = DiagonalGaussianDistribution(h) |
| 816 | |
| 817 | if not return_dict: |
| 818 | return (posterior,) |
| 819 | return AutoencoderKLOutput(latent_dist=posterior) |
| 820 | |
| 821 | def _decode(self, zs): |
| 822 | dec = [ |
Callers
nothing calls this directly
Tested by
no test coverage detected