MCPcopy Create free account
hub / github.com/KeepTryingTo/Pytorch-GAN / LadderBlock

Class LadderBlock

PyTorch-VAE/models/lvae.py:43–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41 return [result, mu, log_var]
42
43class LadderBlock(nn.Module):
44 def __init__(self,
45 in_channels: int,
46 latent_dim: int):
47 super(LadderBlock, self).__init__()
48
49 # Build Decoder
50 self.decode = nn.Sequential(nn.Linear(in_channels, latent_dim),
51 nn.BatchNorm1d(latent_dim))
52 self.fc_mu = nn.Linear(latent_dim, latent_dim)
53 self.fc_var = nn.Linear(latent_dim, latent_dim)
54
55 def forward(self, z: Tensor) -> Tensor:
56 z = self.decode(z)
57 mu = self.fc_mu(z)
58 log_var = self.fc_var(z)
59
60 return [mu, log_var]
61
62class LVAE(BaseVAE):
63

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected