MCPcopy Create free account
hub / github.com/294coder/Dif-PAN / noise_like

Function noise_like

diffusion/diffusion_ddpm_pan.py:79–88  ·  view source on GitHub ↗
(shape, device, repeat=False)

Source from the content-addressed store, hash-verified

77
78
79def noise_like(shape, device, repeat=False):
80 def repeat_noise():
81 return torch.randn((1, *shape[1:]), device=device).repeat(
82 shape[0], *((1,) * (len(shape) - 1))
83 )
84
85 def noise():
86 return torch.randn(shape, device=device)
87
88 return repeat_noise() if repeat else noise()
89
90
91def normal_kl(mean1, logvar1, mean2, logvar2):

Callers 2

p_sampleMethod · 0.85
ddim_sampleMethod · 0.85

Calls 2

repeat_noiseFunction · 0.85
noiseFunction · 0.85

Tested by

no test coverage detected