Created
August 31, 2019 13:57
-
-
Save omarsar/3d78ae4983f534dc9dbccbd1ed639e9f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## the model | |
class MyModel(nn.Module): | |
def __init__(self): | |
super(MyModel, self).__init__() | |
self.d1 = nn.Linear(28 * 28, 128) | |
self.dropout = nn.Dropout(p=0.2) | |
self.d2 = nn.Linear(128, 10) | |
def forward(self, x): | |
x = x.flatten(start_dim = 1) | |
x = self.d1(x) | |
x = F.relu(x) | |
x = self.dropout(x) | |
logits = self.d2(x) | |
out = F.softmax(logits, dim=1) | |
return out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment