MCPcopy Create free account
hub / github.com/Monalissaa/DisenDiff / latent2image

Function latent2image

src/ptp_utils.py:78–84  ·  view source on GitHub ↗
(vae, latents)

Source from the content-addressed store, hash-verified

76
77
78def latent2image(vae, latents):
79 latents = 1 / 0.18215 * latents
80 image = vae.decode(latents)['sample']
81 image = (image / 2 + 0.5).clamp(0, 1)
82 image = image.cpu().permute(0, 2, 3, 1).numpy()
83 image = (image * 255).astype(np.uint8)
84 return image
85
86
87def init_latent(latent, model, height, width, generator, batch_size):

Callers 2

text2image_ldmFunction · 0.85
text2image_ldm_stableFunction · 0.85

Calls 1

decodeMethod · 0.80

Tested by

no test coverage detected