MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / forward

Method forward

cldm/cldm.py:293–314  ·  view source on GitHub ↗
(self, x, hint, timesteps, context, **kwargs)

Source from the content-addressed store, hash-verified

291 return TimestepEmbedSequential(zero_module(conv_nd(self.dims, channels, channels, 1, padding=0)))
292
293 def forward(self, x, hint, timesteps, context, **kwargs):
294 t_emb = timestep_embedding(timesteps, self.model_channels, repeat_only=False)
295 emb = self.time_embed(t_emb)
296
297 guided_hint = self.input_hint_block(hint, emb, context)
298
299 outs = []
300
301 h = x.type(self.dtype)
302 for module, zero_conv in zip(self.input_blocks, self.zero_convs):
303 if guided_hint is not None:
304 h = module(h, emb, context)
305 h += guided_hint
306 guided_hint = None
307 else:
308 h = module(h, emb, context)
309 outs.append(zero_conv(h, emb, context))
310
311 h = self.middle_block(h, emb, context)
312 outs.append(self.middle_block_out(h, emb, context))
313
314 return outs
315
316
317class ControlLDM(LatentDiffusion):

Callers

nothing calls this directly

Calls 1

timestep_embeddingFunction · 0.90

Tested by

no test coverage detected