Upload model.py
Browse files
model.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import torch.nn as nn
|
| 3 |
+
|
| 4 |
+
class Model(nn.Module):
|
| 5 |
+
def __init__(self):
|
| 6 |
+
super().__init__()
|
| 7 |
+
self.ll1 = nn.Linear(768, 1024)
|
| 8 |
+
self.bn1 = nn.BatchNorm1d(2)
|
| 9 |
+
self.elu1 = nn.ELU()
|
| 10 |
+
self.ll2 = nn.Linear(1024, 512)
|
| 11 |
+
self.bn2 = nn.BatchNorm1d(2)
|
| 12 |
+
self.elu2 = nn.ELU()
|
| 13 |
+
self.llf = nn.Linear(512, 1)
|
| 14 |
+
|
| 15 |
+
def forward(self, x):
|
| 16 |
+
x = self.elu1(self.bn1(self.ll1(x)))
|
| 17 |
+
x = self.elu2(self.bn2(self.ll2(x)))
|
| 18 |
+
x = torch.sum(x, dim=1)
|
| 19 |
+
x = self.llf(x)
|
| 20 |
+
return x
|