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

Method forward

ldm/modules/diffusionmodules/model.py:518–543  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

516 padding=1)
517
518 def forward(self, x):
519 # timestep embedding
520 temb = None
521
522 # downsampling
523 hs = [self.conv_in(x)]
524 for i_level in range(self.num_resolutions):
525 for i_block in range(self.num_res_blocks):
526 h = self.down[i_level].block[i_block](hs[-1], temb)
527 if len(self.down[i_level].attn) > 0:
528 h = self.down[i_level].attn[i_block](h)
529 hs.append(h)
530 if i_level != self.num_resolutions-1:
531 hs.append(self.down[i_level].downsample(hs[-1]))
532
533 # middle
534 h = hs[-1]
535 h = self.mid.block_1(h, temb)
536 h = self.mid.attn_1(h)
537 h = self.mid.block_2(h, temb)
538
539 # end
540 h = self.norm_out(h)
541 h = nonlinearity(h)
542 h = self.conv_out(h)
543 return h
544
545
546class Decoder(nn.Module):

Callers

nothing calls this directly

Calls 1

nonlinearityFunction · 0.85

Tested by

no test coverage detected