和nanoDiffusion-main相比,improved-diffusion-main代码是相似的,但有几个不是很好理解的地方记录一下。
一、 TimestepEmbedSequential
代码中class ResBlock继承自TimestepBlock,需要执行时间步嵌入操作,其他不需要。
class TimestepBlock(nn.Module):
"""
Any module where forward() takes timestep embeddings as a second argument.
"""
&#