MCPcopy Create free account
hub / github.com/DPS2022/diffusion-posterior-sampling / TimestepEmbedSequential

Class TimestepEmbedSequential

guided_diffusion/unet.py:137–149  ·  view source on GitHub ↗

A sequential module that passes timestep embeddings to the children that support it as an extra input.

Source from the content-addressed store, hash-verified

135
136
137class TimestepEmbedSequential(nn.Sequential, TimestepBlock):
138 """
139 A sequential module that passes timestep embeddings to the children that
140 support it as an extra input.
141 """
142
143 def forward(self, x, emb):
144 for layer in self:
145 if isinstance(layer, TimestepBlock):
146 x = layer(x, emb)
147 else:
148 x = layer(x)
149 return x
150
151
152class Upsample(nn.Module):

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected