(shape, device, repeat=False)
| 159 | |
| 160 | |
| 161 | def noise_like(shape, device, repeat=False): |
| 162 | repeat_noise = lambda: torch.randn((1, *shape[1:]), device=device).repeat(shape[0], *((1,) * (len(shape) - 1))) |
| 163 | noise = lambda: torch.randn(shape, device=device) |
| 164 | return repeat_noise() if repeat else noise() |
| 165 | |
| 166 | |
| 167 | def linear_beta_schedule(timesteps, max_beta=hparams.get('max_beta', 0.01)): |