class PyTorchNet(nn.Module):
def __init__(self):
super(PyTorchNet, self).__init__()
self.fc1 = nn.Linear(28*28, 512)
self.fc2 = nn.Linear(512, 1024)
self.fc3 = nn.Linear(1024, 128)
self.fc4 = nn.Linear(128, 10)
def forward(self, x):
x = x.view(-1, 28*28)
x = torch.relu(self.fc1(x))
x = torch.relu(self.fc2(x))
x = torch.relu(self.fc3(x))
x = self.fc4(x)
return x
Architecture
Forward
pass