| 177 | |
| 178 | |
| 179 | class ResBlock(nn.Module): |
| 180 | def __init__(self, in_channel, out_channel, blur_kernel=[1, 3, 3, 1]): |
| 181 | super().__init__() |
| 182 | |
| 183 | self.conv1 = ConvLayer(in_channel, in_channel, 3) |
| 184 | self.conv2 = ConvLayer(in_channel, out_channel, 3, downsample=True) |
| 185 | |
| 186 | self.skip = ConvLayer(in_channel, out_channel, 1, downsample=True, activate=False, bias=False) |
| 187 | |
| 188 | def forward(self, input): |
| 189 | out = self.conv1(input) |
| 190 | out = self.conv2(out) |
| 191 | |
| 192 | skip = self.skip(input) |
| 193 | out = (out + skip) / math.sqrt(2) |
| 194 | |
| 195 | return out |
| 196 | |
| 197 | |
| 198 | class EncoderApp(nn.Module): |