MCPcopy Create free account
hub / github.com/Vchitect/Latte / noise_like

Function noise_like

models/utils.py:187–190  ·  view source on GitHub ↗
(shape, device, repeat=False)

Source from the content-addressed store, hash-verified

185
186
187def noise_like(shape, device, repeat=False):
188 repeat_noise = lambda: torch.randn((1, *shape[1:]), device=device).repeat(shape[0], *((1,) * (len(shape) - 1)))
189 noise = lambda: torch.randn(shape, device=device)
190 return repeat_noise() if repeat else noise()
191
192def count_flops_attn(model, _x, y):
193 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected