(self,x)
| 43 | self.kl = 0 |
| 44 | |
| 45 | def forward(self,x): |
| 46 | x = F.relu(self.linear1(x)) |
| 47 | x = F.relu(self.linear2(x)) |
| 48 | mu = self.linear3(x) |
| 49 | sigma = torch.exp(self.linear4(x)) |
| 50 | z = mu + sigma*self.N.sample(mu.shape) |
| 51 | self.kl = (sigma**2 + mu**2 - torch.log(sigma) - 1/2).sum() |
| 52 | return z |
| 53 | class Decoder(nn.Module): |
| 54 | def __init__(self,latent_dims): |
| 55 | super(Decoder,self).__init__() |
nothing calls this directly
no outgoing calls
no test coverage detected