MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / forward

Method forward

sat/sgm/modules/diffusionmodules/model.py:650–683  ·  view source on GitHub ↗
(self, z, **kwargs)

Source from the content-addressed store, hash-verified

648 return self.conv_out.weight
649
650 def forward(self, z, **kwargs):
651 # assert z.shape[1:] == self.z_shape[1:]
652 self.last_z_shape = z.shape
653
654 # timestep embedding
655 temb = None
656
657 # z to block_in
658 h = self.conv_in(z)
659
660 # middle
661 h = self.mid.block_1(h, temb, **kwargs)
662 h = self.mid.attn_1(h, **kwargs)
663 h = self.mid.block_2(h, temb, **kwargs)
664
665 # upsampling
666 for i_level in reversed(range(self.num_resolutions)):
667 for i_block in range(self.num_res_blocks + 1):
668 h = self.up[i_level].block[i_block](h, temb, **kwargs)
669 if len(self.up[i_level].attn) > 0:
670 h = self.up[i_level].attn[i_block](h, **kwargs)
671 if i_level != 0:
672 h = self.up[i_level].upsample(h)
673
674 # end
675 if self.give_pre_end:
676 return h
677
678 h = self.norm_out(h)
679 h = nonlinearity(h)
680 h = self.conv_out(h, **kwargs)
681 if self.tanh_out:
682 h = torch.tanh(h)
683 return h

Callers

nothing calls this directly

Calls 1

nonlinearityFunction · 0.70

Tested by

no test coverage detected