dmme.equations.ddpm#
constants increasing linearly from \(10^{-4}\) to \(0.02\) |
|
Forward Process, \(q(x_t|x_{t-1})\) |
|
Reverse Denoising Process, \(p_\theta(x_{t-1}|x_t)\) |
|
Simple Loss objective \(L_\text{simple}\), MSE loss between noise and predicted noise |
- dmme.equations.ddpm.linear_schedule(timesteps: int, start: float = 0.0001, end: float = 0.02) Tensor[source]#
constants increasing linearly from \(10^{-4}\) to \(0.02\)
- Parameters:
timesteps – total timesteps
start – starting value, defaults to 0.0001
end – end value, defaults to 0.02
- Returns:
a 1d tensor representing \(\beta_t\) indexed by \(t\)
- dmme.equations.ddpm.forward_process(image: Tensor, alpha_bar_t: Tensor) Normal[source]#
Forward Process, \(q(x_t|x_{t-1})\)
- Parameters:
image – image of shape \((N, C, H, W)\)
alpha_bar_t – \(\bar\alpha_t\) of shape \((N, 1, 1, *)\)
noise – noise sampled from standard normal distribution with the same shape as the image
- Returns:
gaussian transition distirbution \(q(x_t|x_{t-1})\)
- dmme.equations.ddpm.reverse_process(x_t: Tensor, beta_t: Tensor, alpha_t: Tensor, alpha_bar_t: Tensor, noise_in_x_t: Tensor, variance: Tensor) Normal[source]#
Reverse Denoising Process, \(p_\theta(x_{t-1}|x_t)\)
- Parameters:
beta_t – \(\beta_t\) of shape \((N, 1, 1, *)\)
alpha_t – \(\alpha_t\) of shape \((N, 1, 1, *)\)
alpha_bar_t – \(\bar\alpha_t\) of shape \((N, 1, 1, *)\)
noise_in_x_t – estimated noise in \(x_t\) predicted by a neural network
variance – variance of the reverse process, either learned or fixed
noise – noise sampled from \(\mathcal{N}(0, I)\)
- Returns:
denoising distirbution \(q(x_t|x_{t-1})\)
- dmme.equations.ddpm.simple_loss(noise: Tensor, estimated_noise: Tensor) Tensor[source]#
Simple Loss objective \(L_\text{simple}\), MSE loss between noise and predicted noise
- Parameters:
noise (torch.Tensor) – noise used in the forward process
estimated_noise (torch.Tensor) – estimated noise with the same shape as
noise