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

Method sample

PyTorch-VAE/models/dip_vae.py:166–182  ·  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

164 'DIP_Loss':dip_loss}
165
166 def sample(self,
167 num_samples:int,
168 current_device: int, **kwargs) -> Tensor:
169 """
170 Samples from the latent space and return the corresponding
171 image space map.
172 :param num_samples: (Int) Number of samples
173 :param current_device: (Int) Device to run the model
174 :return: (Tensor)
175 """
176 z = torch.randn(num_samples,
177 self.latent_dim)
178
179 z = z.to(current_device)
180
181 samples = self.decode(z)
182 return samples
183
184 def generate(self, x: Tensor, **kwargs) -> Tensor:
185 """

Callers

nothing calls this directly

Calls 1

decodeMethod · 0.95

Tested by

no test coverage detected