MCPcopy Create free account
hub / github.com/KeepTryingTo/Pytorch-GAN / sample

Method sample

PyTorch-VAE/models/dfcvae.py:192–208  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 """

Callers

nothing calls this directly

Calls 1

decodeMethod · 0.95

Tested by

no test coverage detected