docstring for Encoder
| 191 | |
| 192 | |
| 193 | class FineEncoder(nn.Module): |
| 194 | """docstring for Encoder""" |
| 195 | |
| 196 | def __init__(self, image_nc, ngf, img_f, layers, norm_layer=nn.BatchNorm2d, nonlinearity=nn.LeakyReLU(), |
| 197 | use_spect=False): |
| 198 | super(FineEncoder, self).__init__() |
| 199 | self.layers = layers |
| 200 | self.first = FirstBlock2d(image_nc, ngf, norm_layer, nonlinearity, use_spect) |
| 201 | for i in range(layers): |
| 202 | in_channels = min(ngf * (2 ** i), img_f) |
| 203 | out_channels = min(ngf * (2 ** (i + 1)), img_f) |
| 204 | model = DownBlock2d(in_channels, out_channels, norm_layer, nonlinearity, use_spect) |
| 205 | setattr(self, 'down' + str(i), model) |
| 206 | self.output_nc = out_channels |
| 207 | |
| 208 | def forward(self, x): |
| 209 | x = self.first(x) |
| 210 | out = [x] |
| 211 | for i in range(self.layers): |
| 212 | model = getattr(self, 'down' + str(i)) |
| 213 | x = model(x) |
| 214 | out.append(x) |
| 215 | return out |
| 216 | |
| 217 | |
| 218 | class FineDecoder(nn.Module): |