Skip to content

Commit c30149e

Browse files
committed
made Magnus Model
1 parent 24b7726 commit c30149e

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Experiments/
66
_build/
77
bin/
88

9+
#Magnus specific
10+
docker/*
11+
912
# Byte-compiled / optimized / DLL files
1013
__pycache__/
1114
*.py[cod]

utils/models/magnus_model.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,34 @@
22

33

44
class MagnusModel(nn.Module):
5-
def __init__(self):
5+
def __init__(self,
6+
imgsize: int,
7+
channels: int,
8+
n_classes:int=10):
69
super().__init__()
10+
self.imgsize = imgsize
11+
self.channels = channels
12+
13+
self.layer1 = nn.Sequential(*([
14+
nn.Linear(self.channels*self.imgsize*self.imgsize, 133),
15+
nn.ReLU()
16+
]))
17+
self.layer2 = nn.Sequential(*([
18+
nn.Linear(133, 133),
19+
nn.ReLU()
20+
]))
21+
self.layer3 = nn.Sequential(*([
22+
nn.Linear(133, n_classes),
23+
nn.ReLU()
24+
]))
725

826
def forward(self, x):
9-
return
27+
assert len(x.size) == 4
28+
29+
x = x.view(x.size(0), -1)
30+
31+
x = self.layer1(x)
32+
x = self.layer2(x)
33+
x = self.layer3(x)
34+
35+
return x

0 commit comments

Comments
 (0)