MCPcopy Create free account
hub / github.com/ShihaoZhaoZSH/Uni-ControlNet / forward

Method forward

ldm/modules/diffusionmodules/model.py:619–652  ·  view source on GitHub ↗
(self, z)

Source from the content-addressed store, hash-verified

617 padding=1)
618
619 def forward(self, z):
620 #assert z.shape[1:] == self.z_shape[1:]
621 self.last_z_shape = z.shape
622
623 # timestep embedding
624 temb = None
625
626 # z to block_in
627 h = self.conv_in(z)
628
629 # middle
630 h = self.mid.block_1(h, temb)
631 h = self.mid.attn_1(h)
632 h = self.mid.block_2(h, temb)
633
634 # upsampling
635 for i_level in reversed(range(self.num_resolutions)):
636 for i_block in range(self.num_res_blocks+1):
637 h = self.up[i_level].block[i_block](h, temb)
638 if len(self.up[i_level].attn) > 0:
639 h = self.up[i_level].attn[i_block](h)
640 if i_level != 0:
641 h = self.up[i_level].upsample(h)
642
643 # end
644 if self.give_pre_end:
645 return h
646
647 h = self.norm_out(h)
648 h = nonlinearity(h)
649 h = self.conv_out(h)
650 if self.tanh_out:
651 h = torch.tanh(h)
652 return h
653
654
655class SimpleDecoder(nn.Module):

Callers

nothing calls this directly

Calls 1

nonlinearityFunction · 0.85

Tested by

no test coverage detected