| 115 | return adain_feat |
| 116 | |
| 117 | class Decoder(nn.Module): |
| 118 | def __init__(self, gpu_ids=[]): |
| 119 | super(Decoder, self).__init__() |
| 120 | decoder = [ |
| 121 | nn.ReflectionPad2d((1, 1, 1, 1)), |
| 122 | nn.Conv2d(512, 256, (3, 3)), |
| 123 | nn.ReLU(), # 256 |
| 124 | nn.Upsample(scale_factor=2, mode='nearest'), |
| 125 | nn.ReflectionPad2d((1, 1, 1, 1)), |
| 126 | nn.Conv2d(256, 256, (3, 3)), |
| 127 | nn.ReLU(), |
| 128 | nn.ReflectionPad2d((1, 1, 1, 1)), |
| 129 | nn.Conv2d(256, 256, (3, 3)), |
| 130 | nn.ReLU(), |
| 131 | nn.ReflectionPad2d((1, 1, 1, 1)), |
| 132 | nn.Conv2d(256, 256, (3, 3)), |
| 133 | nn.ReLU(), |
| 134 | nn.ReflectionPad2d((1, 1, 1, 1)), |
| 135 | nn.Conv2d(256, 128, (3, 3)), |
| 136 | nn.ReLU(),# 128 |
| 137 | nn.Upsample(scale_factor=2, mode='nearest'), |
| 138 | nn.ReflectionPad2d((1, 1, 1, 1)), |
| 139 | nn.Conv2d(128, 128, (3, 3)), |
| 140 | nn.ReLU(), |
| 141 | nn.ReflectionPad2d((1, 1, 1, 1)), |
| 142 | nn.Conv2d(128, 64, (3, 3)), |
| 143 | nn.ReLU(),# 64 |
| 144 | nn.Upsample(scale_factor=2, mode='nearest'), |
| 145 | nn.ReflectionPad2d((1, 1, 1, 1)), |
| 146 | nn.Conv2d(64, 64, (3, 3)), |
| 147 | nn.ReLU(), |
| 148 | nn.ReflectionPad2d((1, 1, 1, 1)), |
| 149 | nn.Conv2d(64, 3, (3, 3)) |
| 150 | ] |
| 151 | self.decoder = nn.Sequential(*decoder) |
| 152 | |
| 153 | def forward(self, adain_feat): |
| 154 | fake_image = self.decoder(adain_feat) |
| 155 | |
| 156 | return fake_image |
nothing calls this directly
no outgoing calls
no test coverage detected