(self, noise_steps=1000, beta_start=1e-4, beta_end=0.02, img_size=256, device="cuda")
| 15 | |
| 16 | class Diffusion: |
| 17 | def __init__(self, noise_steps=1000, beta_start=1e-4, beta_end=0.02, img_size=256, device="cuda"): |
| 18 | self.noise_steps = noise_steps |
| 19 | self.beta_start = beta_start |
| 20 | self.beta_end = beta_end |
| 21 | |
| 22 | self.beta = self.prepare_noise_schedule().to(device) |
| 23 | self.alpha = 1. - self.beta |
| 24 | self.alpha_hat = torch.cumprod(self.alpha, dim=0) |
| 25 | |
| 26 | self.img_size = img_size |
| 27 | self.device = device |
| 28 | |
| 29 | def prepare_noise_schedule(self): |
| 30 | return torch.linspace(self.beta_start, self.beta_end, self.noise_steps) |
nothing calls this directly
no test coverage detected