(self, generator: Optional[torch.Generator] = None)
| 408 | ) |
| 409 | |
| 410 | def sample(self, generator: Optional[torch.Generator] = None) -> torch.FloatTensor: |
| 411 | # make sure sample is on the same device as the parameters and has same dtype |
| 412 | sample = randn_tensor( |
| 413 | self.mean.shape, generator=generator, device=self.parameters.device, dtype=self.parameters.dtype |
| 414 | ) |
| 415 | x = self.mean + self.std * sample |
| 416 | return x |
| 417 | |
| 418 | def kl(self, other=None): |
| 419 | if self.deterministic: |
no test coverage detected