(self, in_size, out_size, in_channels, out_channels, ch_mult=2)
| 820 | |
| 821 | class Upsampler(nn.Module): |
| 822 | def __init__(self, in_size, out_size, in_channels, out_channels, ch_mult=2): |
| 823 | super().__init__() |
| 824 | assert out_size >= in_size |
| 825 | num_blocks = int(np.log2(out_size//in_size))+1 |
| 826 | factor_up = 1.+ (out_size % in_size) |
| 827 | print(f"Building {self.__class__.__name__} with in_size: {in_size} --> out_size {out_size} and factor {factor_up}") |
| 828 | self.rescaler = LatentRescaler(factor=factor_up, in_channels=in_channels, mid_channels=2*in_channels, |
| 829 | out_channels=in_channels) |
| 830 | self.decoder = Decoder(out_ch=out_channels, resolution=out_size, z_channels=in_channels, num_res_blocks=2, |
| 831 | attn_resolutions=[], in_channels=None, ch=in_channels, |
| 832 | ch_mult=[ch_mult for _ in range(num_blocks)]) |
| 833 | |
| 834 | def forward(self, x): |
| 835 | x = self.rescaler(x) |
nothing calls this directly
no test coverage detected