We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents caa0e45 + 52e7c6f commit 02a6911Copy full SHA for 02a6911
models/__init__.py
models/autoencoder.py
@@ -0,0 +1,26 @@
1
+import torch.nn as nn
2
+
3
4
+class Autoencoder(nn.Module):
5
+ def __init__(self, input_dim, encoding_dim):
6
+ super(Autoencoder, self).__init__()
7
+ self.encoder = nn.Sequential(
8
+ nn.Linear(input_dim, 128),
9
+ nn.ReLU(),
10
+ nn.Linear(128, 64),
11
12
+ nn.Linear(64, encoding_dim)
13
+ )
14
+ self.decoder = nn.Sequential(
15
+ nn.Linear(encoding_dim, 64),
16
17
+ nn.Linear(64, 128),
18
19
+ nn.Linear(128, input_dim),
20
+ nn.Sigmoid()
21
22
23
+ def forward(self, x):
24
+ x = self.encoder(x)
25
+ x = self.decoder(x)
26
+ return x
0 commit comments