MCPcopy Create free account
hub / github.com/ShanghaiTech-IMPACT/TeethDreamer / forward

Method forward

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

Source from the content-addressed store, hash-verified

432 padding=1)
433
434 def forward(self, x):
435 # timestep embedding
436 temb = None
437
438 # downsampling
439 hs = [self.conv_in(x)]
440 for i_level in range(self.num_resolutions):
441 for i_block in range(self.num_res_blocks):
442 h = self.down[i_level].block[i_block](hs[-1], temb)
443 if len(self.down[i_level].attn) > 0:
444 h = self.down[i_level].attn[i_block](h)
445 hs.append(h)
446 if i_level != self.num_resolutions-1:
447 hs.append(self.down[i_level].downsample(hs[-1]))
448
449 # middle
450 h = hs[-1]
451 h = self.mid.block_1(h, temb)
452 h = self.mid.attn_1(h)
453 h = self.mid.block_2(h, temb)
454
455 # end
456 h = self.norm_out(h)
457 h = nonlinearity(h)
458 h = self.conv_out(h)
459 return h
460
461
462class Decoder(nn.Module):

Callers

nothing calls this directly

Calls 1

nonlinearityFunction · 0.85

Tested by

no test coverage detected