(noise, iterations=6, discount=0.3)
| 460 | |
| 461 | |
| 462 | def pyramid_noise_like(noise, iterations=6, discount=0.3): |
| 463 | b, c, w, h = noise.shape |
| 464 | u = torch.nn.Upsample(size=(w, h), mode='bilinear') |
| 465 | for i in range(iterations): |
| 466 | r = random.random()*2+2 # Rather than always going 2x, |
| 467 | w, h = max(1, int(w/(r**i))), max(1, int(h/(r**i))) |
| 468 | noise += u(torch.randn((b, c, w, h), device=noise.device)) * discount**i |
| 469 | if w==1 or h==1: break # Lowest resolution is 1x1 |
| 470 | return noise/noise.std() # Scaled back to roughly unit variance |
nothing calls this directly
no outgoing calls
no test coverage detected