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

Function rand_v_diffusion

k_diffusion/utils.py:347–352  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

345
346
347def 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
355def 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):

Callers

nothing calls this directly

Calls 1

stratified_with_settingsFunction · 0.85

Tested by

no test coverage detected