MCPcopy Create free account
hub / github.com/bbaaii/DreamDiffusion / __init__

Method __init__

code/dc_ldm/modules/diffusionmodules/model.py:729–739  ·  view source on GitHub ↗
(self, in_size, out_size, in_channels, out_channels, ch_mult=2)

Source from the content-addressed store, hash-verified

727
728class Upsampler(nn.Module):
729 def __init__(self, in_size, out_size, in_channels, out_channels, ch_mult=2):
730 super().__init__()
731 assert out_size >= in_size
732 num_blocks = int(np.log2(out_size//in_size))+1
733 factor_up = 1.+ (out_size % in_size)
734 print(f"Building {self.__class__.__name__} with in_size: {in_size} --> out_size {out_size} and factor {factor_up}")
735 self.rescaler = LatentRescaler(factor=factor_up, in_channels=in_channels, mid_channels=2*in_channels,
736 out_channels=in_channels)
737 self.decoder = Decoder(out_ch=out_channels, resolution=out_size, z_channels=in_channels, num_res_blocks=2,
738 attn_resolutions=[], in_channels=None, ch=in_channels,
739 ch_mult=[ch_mult for _ in range(num_blocks)])
740
741 def forward(self, x):
742 x = self.rescaler(x)

Callers

nothing calls this directly

Calls 3

LatentRescalerClass · 0.85
DecoderClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected