Data/Data Science
2020. 11. 29.
[Pytorch] Autoencoder Base code
import torch import torchvision import torch.nn.functional as F from torch import nn, optim from torchvision import transforms, datasets class Autoencoder(nn.Module): def __init__(self): super(Autoencoder, self).__init__() self.encoder = nn.Sequential( nn.Linear(28*28, 128), nn.ReLU(), nn.Linear(128, 64), nn.ReLU(), nn.Linear(64, 12), nn.ReLU(), nn.Linear(12, 3), ) self.decoder = nn.Sequential( ..