Spaces:
Build error
Build error
ShAnSantosh
commited on
Commit
•
49b50fa
1
Parent(s):
b289e03
Upload model.py
Browse files
model.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import torch.nn as nn
|
3 |
+
|
4 |
+
|
5 |
+
class NeuralNet(nn.Module):
|
6 |
+
def __init__(self, input_size, hidden_size, num_classes):
|
7 |
+
super(NeuralNet, self).__init__()
|
8 |
+
self.l1 = nn.Linear(input_size, hidden_size)
|
9 |
+
self.l2 = nn.Linear(hidden_size, hidden_size)
|
10 |
+
self.l3 = nn.Linear(hidden_size, num_classes)
|
11 |
+
self.relu = nn.ReLU()
|
12 |
+
|
13 |
+
def forward(self, x):
|
14 |
+
out = self.l1(x)
|
15 |
+
out = self.relu(out)
|
16 |
+
out = self.l2(out)
|
17 |
+
out = self.relu(out)
|
18 |
+
out = self.l3(out)
|
19 |
+
# no activation and no softmax at the end
|
20 |
+
return out
|