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

Class AE

Denoising_AutoEncoder/net/AE.py:11–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9from torchinfo import summary
10
11class AE(torch.nn.Module):
12 def __init__(self,in_feautres = 784,out_features = 128):
13 super(AE, self).__init__()
14 self.encoder = torch.nn.Sequential(
15 torch.nn.Linear(in_features=in_feautres,out_features=512),
16 torch.nn.ReLU(),
17
18 torch.nn.Linear(in_features=512,out_features=256),
19 torch.nn.ReLU(),
20
21 torch.nn.Linear(in_features=256,out_features=out_features),
22 )
23 self.decoder = torch.nn.Sequential(
24 torch.nn.Linear(in_features=out_features, out_features=256),
25 torch.nn.ReLU(),
26
27 torch.nn.Linear(in_features=256, out_features=512),
28 torch.nn.ReLU(),
29
30 torch.nn.Linear(in_features=512, out_features=in_feautres)
31 )
32 def forward(self,x):
33 x = x.view(-1,784)
34 e_x = self.encoder(x)
35 d_x = self.decoder(e_x)
36 img = d_x.view(-1,28,28)
37 return img
38
39if __name__ == '__main__':
40 x= torch.randn(size = (1,28,28),device='cpu')

Callers 2

train.pyFile · 0.90
AE.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected