MCPcopy Create free account
hub / github.com/NVIDIA/pix2pixHD / __init__

Method __init__

models/networks.py:256–275  ·  view source on GitHub ↗
(self, input_nc, output_nc, ngf=32, n_downsampling=4, norm_layer=nn.BatchNorm2d)

Source from the content-addressed store, hash-verified

254
255class Encoder(nn.Module):
256 def __init__(self, input_nc, output_nc, ngf=32, n_downsampling=4, norm_layer=nn.BatchNorm2d):
257 super(Encoder, self).__init__()
258 self.output_nc = output_nc
259
260 model = [nn.ReflectionPad2d(3), nn.Conv2d(input_nc, ngf, kernel_size=7, padding=0),
261 norm_layer(ngf), nn.ReLU(True)]
262 ### downsample
263 for i in range(n_downsampling):
264 mult = 2**i
265 model += [nn.Conv2d(ngf * mult, ngf * mult * 2, kernel_size=3, stride=2, padding=1),
266 norm_layer(ngf * mult * 2), nn.ReLU(True)]
267
268 ### upsample
269 for i in range(n_downsampling):
270 mult = 2**(n_downsampling - i)
271 model += [nn.ConvTranspose2d(ngf * mult, int(ngf * mult / 2), kernel_size=3, stride=2, padding=1, output_padding=1),
272 norm_layer(int(ngf * mult / 2)), nn.ReLU(True)]
273
274 model += [nn.ReflectionPad2d(3), nn.Conv2d(ngf, output_nc, kernel_size=7, padding=0), nn.Tanh()]
275 self.model = nn.Sequential(*model)
276
277 def forward(self, input, inst):
278 outputs = self.model(input)

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected