-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.py
36 lines (30 loc) · 1.09 KB
/
model.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
from linear_layer import Linearlayer
from activation_functions import *
class Model:
def __init__(self):
self.layers = [
Linearlayer(784, 784, bias=True),
Relu(),
Linearlayer(784, 1024, bias=True),
Relu(),
Linearlayer(1024, 2048, bias=True),
Relu(),
Linearlayer(2048, 1024, bias=True),
Relu(),
Linearlayer(1024, 784, bias=True),
Relu(),
Linearlayer(784, 10, bias=True)
]
def forward(self,x):
x = self.layers[0].forward(x)
x = self.layers[1].forward(x)
x = self.layers[2].forward(x)
x = self.layers[3].forward(x)
x = self.layers[4].forward(x)
x = self.layers[5].forward(x)
x = self.layers[6].forward(x)
x = self.layers[7].forward(x)
x = self.layers[8].forward(x)
x = self.layers[9].forward(x)
x = self.layers[10].forward(x)
return x