MCPcopy Create free account
hub / github.com/ali-vilab/dreamtalk / FineDecoder

Class FineDecoder

generators/base_function.py:215–245  ·  view source on GitHub ↗

docstring for FineDecoder

Source from the content-addressed store, hash-verified

213 return out
214
215class FineDecoder(nn.Module):
216 """docstring for FineDecoder"""
217 def __init__(self, image_nc, feature_nc, ngf, img_f, layers, num_block, norm_layer=nn.BatchNorm2d, nonlinearity=nn.LeakyReLU(), use_spect=False):
218 super(FineDecoder, self).__init__()
219 self.layers = layers
220 for i in range(layers)[::-1]:
221 in_channels = min(ngf*(2**(i+1)), img_f)
222 out_channels = min(ngf*(2**i), img_f)
223 up = UpBlock2d(in_channels, out_channels, norm_layer, nonlinearity, use_spect)
224 res = FineADAINResBlocks(num_block, in_channels, feature_nc, norm_layer, nonlinearity, use_spect)
225 jump = Jump(out_channels, norm_layer, nonlinearity, use_spect)
226
227 setattr(self, 'up' + str(i), up)
228 setattr(self, 'res' + str(i), res)
229 setattr(self, 'jump' + str(i), jump)
230
231 self.final = FinalBlock2d(out_channels, image_nc, use_spect, 'tanh')
232
233 self.output_nc = out_channels
234
235 def forward(self, x, z):
236 out = x.pop()
237 for i in range(self.layers)[::-1]:
238 res_model = getattr(self, 'res' + str(i))
239 up_model = getattr(self, 'up' + str(i))
240 jump_model = getattr(self, 'jump' + str(i))
241 out = res_model(out, z)
242 out = up_model(out)
243 out = jump_model(x.pop()) + out
244 out_image = self.final(out)
245 return out_image
246
247class FirstBlock2d(nn.Module):
248 """

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected