Draws samples from a truncated v-diffusion training timestep distribution.
(shape, sigma_data=1., min_value=0., max_value=float('inf'), device='cpu', dtype=torch.float32)
| 345 | |
| 346 | |
| 347 | def rand_v_diffusion(shape, sigma_data=1., min_value=0., max_value=float('inf'), device='cpu', dtype=torch.float32): |
| 348 | """Draws samples from a truncated v-diffusion training timestep distribution.""" |
| 349 | min_cdf = math.atan(min_value / sigma_data) * 2 / math.pi |
| 350 | max_cdf = math.atan(max_value / sigma_data) * 2 / math.pi |
| 351 | u = stratified_with_settings(shape, device=device, dtype=dtype) * (max_cdf - min_cdf) + min_cdf |
| 352 | return torch.tan(u * math.pi / 2) * sigma_data |
| 353 | |
| 354 | |
| 355 | def rand_cosine_interpolated(shape, image_d, noise_d_low, noise_d_high, sigma_data=1., min_value=1e-3, max_value=1e3, device='cpu', dtype=torch.float32): |
nothing calls this directly
no test coverage detected