MCPcopy Create free account
hub / github.com/IceClear/StableSR / noise_like

Function noise_like

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

Source from the content-addressed store, hash-verified

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

Callers 10

p_sample_ddimMethod · 0.90
p_sample_ddim_sr_tMethod · 0.90
p_sampleMethod · 0.90
p_sampleMethod · 0.90
p_sampleMethod · 0.90
p_sample_canvasMethod · 0.90
p_sampleMethod · 0.90
p_sampleMethod · 0.90

Calls 1

repeatMethod · 0.80

Tested by

no test coverage detected