Commit ·
03f468d
1
Parent(s): dc5aaf7
Upload network definition class and model weight dict
Browse files- mnist_model.pt +3 -0
- mnist_model.py +18 -0
mnist_model.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7faac19f519a6a3108f7684c7a7922292e12368816650c0be8528ca0a7fc6e98
|
| 3 |
+
size 90352
|
mnist_model.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch.nn as nn
|
| 2 |
+
import torch.nn.functional as F
|
| 3 |
+
|
| 4 |
+
class Net(nn.Module):
|
| 5 |
+
def __init__(self):
|
| 6 |
+
super(Net, self).__init__()
|
| 7 |
+
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
|
| 8 |
+
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
|
| 9 |
+
self.fc1 = nn.Linear(320, 50)
|
| 10 |
+
self.fc2 = nn.Linear(50, 10)
|
| 11 |
+
|
| 12 |
+
def forward(self, x):
|
| 13 |
+
x = F.relu(F.max_pool2d(self.conv1(x), 2))
|
| 14 |
+
x = F.relu(F.max_pool2d(self.conv2(x), 2))
|
| 15 |
+
x = x.view(-1, 320)
|
| 16 |
+
x = F.relu(self.fc1(x))
|
| 17 |
+
x = self.fc2(x)
|
| 18 |
+
return F.log_softmax(x, dim=1)
|