dghdgkl commited on
Commit
2c4bafe
·
verified ·
1 Parent(s): 6a3f4a1

Create review

Browse files
Files changed (1) hide show
  1. review +14 -0
review ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+
3
+ class GaussianDiffusion(nn.Module):
4
+ def __init__(self, model, timesteps=1000, beta_start=1e-4, beta_end=0.02):
5
+ super(GaussianDiffusion, self).__init__()
6
+ self.model = model
7
+ self.timesteps = timesteps
8
+
9
+ # Create a schedule of betas (noise variance at each timestep)
10
+ self.betas = torch.linspace(beta_start, beta_end, timesteps)
11
+ self.alphas = 1 - self.betas
12
+ self.alpha_cumprod = torch.cumprod(self.alphas, dim=0)
13
+
14
+ def add