-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnet_review.py
74 lines (59 loc) · 1.77 KB
/
net_review.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import torch.nn.functional as F
import torch.nn as nn
class BKNet(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.fc1 = nn.Linear(11, 24)
self.fc2 = nn.Linear(24, 24)
self.fc3 = nn.Linear(24, 1)
def forward(self, x):
x = F.relu(self.fc1(x))
x = F.relu(self.fc2(x))
x = self.fc3(x)
x = x[:, -1, :]
return x
class Net(nn.Module):
def __init__(self, input_shape=31, nb_classes=11):
super(Net, self).__init__()
self.fc1 = nn.Linear(input_shape, 64)
self.relu1 = nn.ReLU()
self.fc2 = nn.Linear(64, 32)
self.relu2 = nn.ReLU()
self.dropout = nn.Dropout(0.2)
self.fc3 = nn.Linear(32, nb_classes)
# self.softmax = nn.Softmax(dim=1)
def forward(self, x):
x = self.fc1(x)
x = self.relu1(x)
x = self.fc2(x)
x = self.relu2(x)
x = self.dropout(x)
x = self.fc3(x)
# x = self.softmax(x)
return x
class BKNet(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.fc1 = nn.Linear(11, 24)
self.fc2 = nn.Linear(24, 24)
self.fc3 = nn.Linear(24, 1)
def forward(self, x):
x = F.relu(self.fc1(x))
x = F.relu(self.fc2(x))
x = self.fc3(x)
x = x[:, -1, :]
return x
class OriginalNet(nn.Module):
def __init__(self):
super(OriginalNet, self).__init__()
self.fc1 = nn.Linear(11, 24)
self.fc2 = nn.Linear(24, 24)
self.fc3 = nn.Linear(24, 24)
self.fc4 = nn.Linear(24, 1)
def forward(self, x):
x = F.relu(self.fc1(x))
x = F.relu(self.fc2(x))
x = F.relu(self.fc3(x))
x = self.fc4(x)
x = x[:, -1, :]
return x