MCPcopy Create free account
hub / github.com/CompVis/diff2flow / TimestepEmbedSequential

Class TimestepEmbedSequential

diff2flow/models/unet/openaimodel.py:77–91  ·  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

75
76
77class TimestepEmbedSequential(nn.Sequential, TimestepBlock):
78 """
79 A sequential module that passes timestep embeddings to the children that
80 support it as an extra input.
81 """
82
83 def forward(self, x, emb, context=None):
84 for layer in self:
85 if isinstance(layer, TimestepBlock):
86 x = layer(x, emb)
87 elif isinstance(layer, SpatialTransformer):
88 x = layer(x, context)
89 else:
90 x = layer(x)
91 return x
92
93
94class Upsample(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected