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