MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / logsnr_schedule_cosine

Function logsnr_schedule_cosine

k_diffusion/utils.py:358–361  ·  view source on GitHub ↗
(t, logsnr_min, logsnr_max)

Source from the content-addressed store, hash-verified

356 """Draws samples from an interpolated cosine timestep distribution (from simple diffusion)."""
357
358 def logsnr_schedule_cosine(t, logsnr_min, logsnr_max):
359 t_min = math.atan(math.exp(-0.5 * logsnr_max))
360 t_max = math.atan(math.exp(-0.5 * logsnr_min))
361 return -2 * torch.log(torch.tan(t_min + t * (t_max - t_min)))
362
363 def logsnr_schedule_cosine_shifted(t, image_d, noise_d, logsnr_min, logsnr_max):
364 shift = 2 * math.log(noise_d / image_d)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected