(shape, device, repeat=False)
| 185 | |
| 186 | |
| 187 | def 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 | |
| 192 | def count_flops_attn(model, _x, y): |
| 193 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected