Skip to content

Instantly share code, notes, and snippets.

@n0obcoder
Last active August 13, 2019 17:05
Show Gist options
  • Save n0obcoder/3ba47013e21ce4628cb6f6220d30880f to your computer and use it in GitHub Desktop.
Save n0obcoder/3ba47013e21ce4628cb6f6220d30880f to your computer and use it in GitHub Desktop.
class NeuralNet(nn.Module):
def __init__(self):
super(NeuralNet, self).__init__()
self.sequential = nn.Sequential(nn.Conv2d(1, 32, 5),
nn.Conv2d(32, 64, 5),
nn.Dropout(0.3))
self.layer1 = nn.Conv2d(64, 128, 5)
self.layer2 = nn.Conv2d(128, 256, 5)
self.fc = nn.Linear(256*34*34, 128)
def forward(self, x):
output = self.sequential(x)
output = self.layer1(output)
output = self.layer2(output)
output = output.view(output.size()[0], -1)
output = self.fc(output)
return output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment