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

Method __init__

models/networks.py:596–615  ·  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

594
595class Encoder(nn.Module):
596 def __init__(self, input_nc, output_nc, ngf=32, n_downsampling=4, norm_layer=nn.BatchNorm2d):
597 super(Encoder, self).__init__()
598 self.output_nc = output_nc
599
600 model = [nn.ReflectionPad2d(3), nn.Conv2d(input_nc, ngf, kernel_size=7, padding=0),
601 norm_layer(ngf), nn.ReLU(True)]
602 ### downsample
603 for i in range(n_downsampling):
604 mult = 2**i
605 model += [nn.Conv2d(ngf * mult, ngf * mult * 2, kernel_size=3, stride=2, padding=1),
606 norm_layer(ngf * mult * 2), nn.ReLU(True)]
607
608 ### upsample
609 for i in range(n_downsampling):
610 mult = 2**(n_downsampling - i)
611 model += [nn.ConvTranspose2d(ngf * mult, int(ngf * mult / 2), kernel_size=3, stride=2, padding=1, output_padding=1),
612 norm_layer(int(ngf * mult / 2)), nn.ReLU(True)]
613
614 model += [nn.ReflectionPad2d(3), nn.Conv2d(ngf, output_nc, kernel_size=7, padding=0), nn.Tanh()]
615 self.model = nn.Sequential(*model)
616
617 def forward(self, input, inst):
618 outputs = self.model(input)

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected