MCPcopy Create free account
hub / github.com/AntixK/PyTorch-VAE / __init__

Method __init__

models/lvae.py:13–30  ·  view source on GitHub ↗
(self,
                 in_channels: int,
                 out_channels: int,
                 latent_dim: int,
                 img_size: int)

Source from the content-addressed store, hash-verified

11
12class EncoderBlock(nn.Module):
13 def __init__(self,
14 in_channels: int,
15 out_channels: int,
16 latent_dim: int,
17 img_size: int):
18 super(EncoderBlock, self).__init__()
19
20 # Build Encoder
21 self.encoder = nn.Sequential(
22 nn.Conv2d(in_channels,
23 out_channels,
24 kernel_size=3, stride=2, padding=1),
25 nn.BatchNorm2d(out_channels),
26 nn.LeakyReLU())
27
28 out_size = conv_out_shape(img_size)
29 self.encoder_mu = nn.Linear(out_channels * out_size ** 2 , latent_dim)
30 self.encoder_var = nn.Linear(out_channels * out_size ** 2, latent_dim)
31
32 def forward(self, input: Tensor) -> Tensor:
33 result = self.encoder(input)

Callers

nothing calls this directly

Calls 2

conv_out_shapeFunction · 0.85
__init__Method · 0.45

Tested by

no test coverage detected