MCPcopy Create free account
hub / github.com/AlayaLab/Hive / sample

Method sample

models/flowsep/diffusers/models/vae.py:410–416  ·  view source on GitHub ↗
(self, generator: Optional[torch.Generator] = None)

Source from the content-addressed store, hash-verified

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:

Callers 15

_encode_vae_imageMethod · 0.45
prepare_latentsMethod · 0.45
__call__Method · 0.45
prepare_image_latentsMethod · 0.45
__call__Method · 0.45
prepare_latentsMethod · 0.45
prepare_latentsMethod · 0.45
prepare_latentsMethod · 0.45
_generateMethod · 0.45
_encode_vae_imageMethod · 0.45
_generateMethod · 0.45

Calls 1

randn_tensorFunction · 0.85

Tested by

no test coverage detected