Upload model.py
Browse files
model.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import torch.nn as nn
|
3 |
+
|
4 |
+
class AddModel(nn.Module):
|
5 |
+
"""
|
6 |
+
Input(2) -> Linear(32) -> ReLU -> Linear(64) -> ReLU -> Linear(1) -> Output
|
7 |
+
"""
|
8 |
+
def __init__(self):
|
9 |
+
super(AddModel, self).__init__()
|
10 |
+
self.fc1 = nn.Linear(2, 32)
|
11 |
+
self.relu1 = nn.ReLU()
|
12 |
+
self.fc2 = nn.Linear(32, 64)
|
13 |
+
self.relu2 = nn.ReLU()
|
14 |
+
self.fc3 = nn.Linear(64, 1)
|
15 |
+
|
16 |
+
def forward(self, x):
|
17 |
+
x = self.relu1(self.fc1(x))
|
18 |
+
x = self.relu2(self.fc2(x))
|
19 |
+
x = self.fc3(x)
|
20 |
+
return x
|