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

Method forward

guided_diffusion/unet.py:295–305  ·  view source on GitHub ↗

Apply the block to a Tensor, conditioned on a timestep embedding. :param x: an [N x C x ...] Tensor of features. :param emb: an [N x emb_channels] Tensor of timestep embeddings. :return: an [N x C x ...] Tensor of outputs.

(self, x, emb)

Source from the content-addressed store, hash-verified

293 self.skip_connection = conv_nd(dims, channels, self.out_channels, 1)
294
295 def forward(self, x, emb):
296 """
297 Apply the block to a Tensor, conditioned on a timestep embedding.
298
299 :param x: an [N x C x ...] Tensor of features.
300 :param emb: an [N x emb_channels] Tensor of timestep embeddings.
301 :return: an [N x C x ...] Tensor of outputs.
302 """
303 return checkpoint(
304 self._forward, (x, emb), self.parameters(), self.use_checkpoint
305 )
306
307 def _forward(self, x, emb):
308 if self.updown:

Callers

nothing calls this directly

Calls 1

checkpointFunction · 0.85

Tested by

no test coverage detected