MCPcopy Create free account
hub / github.com/IceClear/StableSR / __init__

Method __init__

ldm/modules/diffusionmodules/model.py:998–1008  ·  view source on GitHub ↗
(self, in_size, out_size, in_channels, out_channels, ch_mult=2)

Source from the content-addressed store, hash-verified

996
997class Upsampler(nn.Module):
998 def __init__(self, in_size, out_size, in_channels, out_channels, ch_mult=2):
999 super().__init__()
1000 assert out_size >= in_size
1001 num_blocks = int(np.log2(out_size//in_size))+1
1002 factor_up = 1.+ (out_size % in_size)
1003 print(f"Building {self.__class__.__name__} with in_size: {in_size} --> out_size {out_size} and factor {factor_up}")
1004 self.rescaler = LatentRescaler(factor=factor_up, in_channels=in_channels, mid_channels=2*in_channels,
1005 out_channels=in_channels)
1006 self.decoder = Decoder(out_ch=out_channels, resolution=out_size, z_channels=in_channels, num_res_blocks=2,
1007 attn_resolutions=[], in_channels=None, ch=in_channels,
1008 ch_mult=[ch_mult for _ in range(num_blocks)])
1009
1010 def forward(self, x):
1011 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