参考:
https://arxiv.org/pdf/2006.11239.pdf ##论文
https://github.com/dtransposed/code_videos/blob/main/01_Diffusion_Models_Tutorial/Diffusion%20Model.ipynb ##code
https://spaces.ac.cn/archives/9119
1、红色框:
前向过程论文公式推出可以从x0原图一步到最终噪声图
2、βt是每次加噪的方差
代码
import torchvision.transforms as transforms
import torch.nn as nn
import torchvision
import matplotlib.pyplot as plt
import torch
from PIL import Image
from torchvision import transforms
def forward_diffusion(x_0