MCPcopy Index your code
hub / github.com/CompVis/diff2flow / __init__

Method __init__

diff2flow/diffusion.py:37–46  ·  view source on GitHub ↗
(self,
                 im_size: int = 64,
                 n_diffusion_timesteps: int = 1000)

Source from the content-addressed store, hash-verified

35
36class 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 """

Callers

nothing calls this directly

Calls 3

shifted_cosine_alpha_barFunction · 0.85
register_bufferMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected