-
Notifications
You must be signed in to change notification settings - Fork 2
/
mlp.py
41 lines (31 loc) · 792 Bytes
/
mlp.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
import time
import torch
from torch import nn, optim
import numpy as np
import sys
import os
import torch.nn.functional as F
from torchsummary import summary
class MLP(nn.Module):
def __init__(self):
super(MLP, self).__init__()
self.linear = nn.Sequential(
nn.Linear(10,32),
nn.LayerNorm(32),
nn.ReLU(),
nn.Linear(32,64),
nn.LayerNorm(64),
nn.ReLU(),
nn.Linear(64,64),
nn.LayerNorm(64),
nn.ReLU(),
nn.Linear(64,64),
nn.LayerNorm(64),
nn.ReLU(),
nn.Linear(64,1),
nn.LayerNorm(1),
nn.ReLU()
)
def forward(self, x):
out = self.linear(x)
return out