Views
No views yet
1import torch
2
3class SpectralAE(torch.nn.Module):
4 def __init__(self, n_in=496, n_lat=64):
5 super().__init__()
6 self.enc = torch.nn.Sequential(
7 torch.nn.Linear(n_in, 256), torch.nn.BatchNorm1d(256), torch.nn.ReLU(), torch.nn.Dropout(0.1),
8 torch.nn.Linear(256, 128), torch.nn.ReLU(),
9 torch.nn.Linear(128, n_lat))
10 self.dec = torch.nn.Sequential(
11 torch.nn.Linear(n_lat, 128), torch.nn.ReLU(),
12 torch.nn.Linear(128, 256), torch.nn.BatchNorm1d(256), torch.nn.ReLU(), torch.nn.Dropout(0.1),
13 torch.nn.Linear(256, n_in))
14 def forward(self, x): return self.dec(self.enc(x))
15
16model = SpectralAE()
17model.load_state_dict(torch.load("autoencoder_model.pt"))
18model.eval()