(self, in_size, out_size, in_channels, out_channels, ch_mult=2)
| 727 | |
| 728 | class 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) |
nothing calls this directly
no test coverage detected