Skip to content

Instantly share code, notes, and snippets.

@darkmatter18
Created June 19, 2019 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkmatter18/704afa08c3f25fb038ca835cd577eb9d to your computer and use it in GitHub Desktop.
Save darkmatter18/704afa08c3f25fb038ca835cd577eb9d to your computer and use it in GitHub Desktop.
#Import Torch.nn
from torch import nn
#Declaring Class
class Network(nn.Module):
def __init__():
super(type(self), self).init()
self.hidden = nn.Linear(784, 256)
self.output = nn.Linear(256, 10)
self.sigmoid = nn.Sigmoid()
self.softmax = nn.Softmax(dim=1)
def forward(self, x):
x = self.hidden(x)
x = self.sigmoid(x)
x = self.output(x)
x = self.softmax(x)
return x
# Initialing the object
model = Network()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment