MCPcopy Index your code
hub / github.com/VisionXLab/OF-Diff / noise_like

Function noise_like

ldm/modules/diffusionmodules/util.py:267–270  ·  view source on GitHub ↗
(shape, device, repeat=False)

Source from the content-addressed store, hash-verified

265
266
267def noise_like(shape, device, repeat=False):
268 repeat_noise = lambda: torch.randn((1, *shape[1:]), device=device).repeat(shape[0], *((1,) * (len(shape) - 1)))
269 noise = lambda: torch.randn(shape, device=device)
270 return repeat_noise() if repeat else noise()

Callers 5

p_sample_ddimMethod · 0.90
p_sampleMethod · 0.90
p_sampleMethod · 0.90
p_sample_ddimMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected