Skip to content

Instantly share code, notes, and snippets.

@vinimonteiro
Created December 17, 2021 14:57
Show Gist options
  • Save vinimonteiro/10868b3cd158755d0998dcae92dffba0 to your computer and use it in GitHub Desktop.
Save vinimonteiro/10868b3cd158755d0998dcae92dffba0 to your computer and use it in GitHub Desktop.
nn_pytorch_neuralnet
class NeuralNetwork(nn.Module):
def __init__(self):
super().__init__()
self.fc1 = nn.Linear(784, 86)
self.fc2 = nn.Linear(86, 86)
self.fc3 = nn.Linear(86, 86)
self.fc4 = nn.Linear(86, 10)
def forward(self, x):
x = F.relu(self.fc1(x))
x = F.relu(self.fc2(x))
x = F.relu(self.fc3(x))
x = self.fc4(x)
return F.log_softmax(x, dim=1)
model = NeuralNetwork()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment