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

Function init_latent

src/ptp_utils.py:87–94  ·  view source on GitHub ↗
(latent, model, height, width, generator, batch_size)

Source from the content-addressed store, hash-verified

85
86
87def init_latent(latent, model, height, width, generator, batch_size):
88 if latent is None:
89 latent = torch.randn(
90 (1, model.unet.in_channels, height // 8, width // 8),
91 generator=generator,
92 )
93 latents = latent.expand(batch_size, model.unet.in_channels, height // 8, width // 8).to(model.device)
94 return latent, latents
95
96
97@torch.no_grad()

Callers 2

text2image_ldmFunction · 0.85
text2image_ldm_stableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected