MCPcopy Create free account
hub / github.com/OpenTalker/StyleHEAT / ADAINEncoder

Class ADAINEncoder

models/styleheat/base_function.py:39–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37
38
39class ADAINEncoder(nn.Module):
40 def __init__(self, image_nc, pose_nc, ngf, img_f, layers, nonlinearity=nn.LeakyReLU(), use_spect=False):
41 super(ADAINEncoder, self).__init__()
42 self.layers = layers
43 self.input_layer = nn.Conv2d(image_nc, ngf, kernel_size=7, stride=1, padding=3)
44 for i in range(layers):
45 in_channels = min(ngf * (2 ** i), img_f)
46 out_channels = min(ngf * (2 ** (i + 1)), img_f)
47 model = ADAINEncoderBlock(in_channels, out_channels, pose_nc, nonlinearity, use_spect)
48 setattr(self, 'encoder' + str(i), model)
49 self.output_nc = out_channels
50
51 def forward(self, x, z):
52 out = self.input_layer(x)
53 out_list = [out]
54 for i in range(self.layers):
55 model = getattr(self, 'encoder' + str(i))
56 out = model(out, z)
57 out_list.append(out)
58 return out_list
59
60
61class ADAINDecoder(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected