Skip to content

Instantly share code, notes, and snippets.

@vaibhavkumar049
Created June 8, 2019 19:14
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 vaibhavkumar049/ad15b797210521e050db9eb8fb563b6a to your computer and use it in GitHub Desktop.
Save vaibhavkumar049/ad15b797210521e050db9eb8fb563b6a to your computer and use it in GitHub Desktop.
class FirstNetwork_v1(nn.Module):
def __init__(self):
super().__init__()
torch.manual_seed(0)
self.lin1 = nn.Linear(2, 2)
self.lin2 = nn.Linear(2, 4)
def forward(self, X):
a1 = self.lin1(X)
h1 = a1.sigmoid()
a2 = self.lin2(h1)
h2 = a2.exp()/a2.exp().sum(-1).unsqueeze(-1)
return h2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment