Samples from the latent space and return the corresponding image space map. :param num_samples: (Int) Number of samples :param current_device: (Int) Device to run the model :return: (Tensor)
(self,
num_samples:int,
current_device: int, **kwargs)
| 190 | return {'loss': loss, 'Reconstruction_Loss':recons_loss, 'KLD':-kld_loss} |
| 191 | |
| 192 | def sample(self, |
| 193 | num_samples:int, |
| 194 | current_device: int, **kwargs) -> Tensor: |
| 195 | """ |
| 196 | Samples from the latent space and return the corresponding |
| 197 | image space map. |
| 198 | :param num_samples: (Int) Number of samples |
| 199 | :param current_device: (Int) Device to run the model |
| 200 | :return: (Tensor) |
| 201 | """ |
| 202 | z = torch.randn(num_samples, |
| 203 | self.latent_dim) |
| 204 | |
| 205 | z = z.to(current_device) |
| 206 | |
| 207 | samples = self.decode(z) |
| 208 | return samples |
| 209 | |
| 210 | def generate(self, x: Tensor, **kwargs) -> Tensor: |
| 211 | """ |