Upload app.py
Browse files
app.py
CHANGED
@@ -7,18 +7,18 @@ class CNN(nn.Module):
|
|
7 |
"""
|
8 |
A custom CNN class. The network has: (1) a convolution layer with 1 input channel and 16 output channels with ReLU activation and 2x2 max-pooling, (2) a second convolution layer with 16 input channels and 32 output channels with ReLU activation and 2x2 max-pooling, and (3) a linear output layer with 10 outputs.
|
9 |
"""
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
self.out = nn.Linear(32*7*7,10)
|
23 |
|
24 |
# Forward propogation method
|
|
|
7 |
"""
|
8 |
A custom CNN class. The network has: (1) a convolution layer with 1 input channel and 16 output channels with ReLU activation and 2x2 max-pooling, (2) a second convolution layer with 16 input channels and 32 output channels with ReLU activation and 2x2 max-pooling, and (3) a linear output layer with 10 outputs.
|
9 |
"""
|
10 |
+
def __init__(self):
|
11 |
+
super(CNN,self).__init__()
|
12 |
+
self.conv1 = nn.Sequential(
|
13 |
+
nn.Conv2d(1,16,5,stride=1,padding=2),
|
14 |
+
nn.ReLU(),
|
15 |
+
nn.MaxPool2d(kernel_size=2),
|
16 |
+
)
|
17 |
+
self.conv2 = nn.Sequential(
|
18 |
+
nn.Conv2d(16,32,5,1,2),
|
19 |
+
nn.ReLU(),
|
20 |
+
nn.MaxPool2d(2),
|
21 |
+
)
|
22 |
self.out = nn.Linear(32*7*7,10)
|
23 |
|
24 |
# Forward propogation method
|