MCPcopy Create free account
hub / github.com/dome272/Diffusion-Models-pytorch / __init__

Method __init__

ddpm_conditional.py:17–27  ·  view source on GitHub ↗
(self, noise_steps=1000, beta_start=1e-4, beta_end=0.02, img_size=256, device="cuda")

Source from the content-addressed store, hash-verified

15
16class 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)

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected