(self,
im_size: int = 64,
n_diffusion_timesteps: int = 1000)
| 35 | |
| 36 | class ForwardDiffusion(nn.Module): |
| 37 | def __init__(self, |
| 38 | im_size: int = 64, |
| 39 | n_diffusion_timesteps: int = 1000): |
| 40 | super().__init__() |
| 41 | self.n_diffusion_timesteps = n_diffusion_timesteps |
| 42 | cos_alpha_bar_t = shifted_cosine_alpha_bar( |
| 43 | np.linspace(0, 1, n_diffusion_timesteps), |
| 44 | im_size=im_size |
| 45 | ).astype(np.float32) |
| 46 | self.register_buffer("alpha_bar_t", torch.from_numpy(cos_alpha_bar_t)) |
| 47 | |
| 48 | def q_sample(self, x_start, t, noise=None): |
| 49 | """ |
nothing calls this directly
no test coverage detected