(self, x)
| 23 | self.t_conv2 = nn.ConvTranspose2d(16, 3, 2, stride=2) |
| 24 | |
| 25 | def forward(self, x): |
| 26 | ## encode ## |
| 27 | # add hidden layers with relu activation function |
| 28 | # and maxpooling after |
| 29 | x = F.relu(self.conv1(x)) |
| 30 | x = self.pool(x) |
| 31 | # add second hidden layer |
| 32 | x = F.relu(self.conv2(x)) |
| 33 | x = self.pool(x) # compressed representation |
| 34 | |
| 35 | ## decode ## |
| 36 | # add transpose conv layers, with relu activation function |
| 37 | x = F.relu(self.t_conv1(x)) |
| 38 | # # output layer (with tanh for scaling from -1 to 1) |
| 39 | x = F.tanh(self.t_conv2(x)) |
| 40 | # output layer (with tanh for scaling from 0 to 1) |
| 41 | # x = F.sigmoid(self.t_conv2(x)) |
| 42 | |
| 43 | return x |
| 44 | |
| 45 | class autoencoder_vgg1(nn.Module): # psnr 20.84 |
| 46 | def __init__(self): |
nothing calls this directly
no outgoing calls
no test coverage detected