参考:
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 torchvisionimport matplotlib.pyplot as plt
import torchfrom PIL import Image
from torchvision import transformsdef forward_diffusion(x_0