Skip to content

Commit

Permalink
made Magnus Model
Browse files Browse the repository at this point in the history
  • Loading branch information
Seilmast committed Feb 3, 2025
1 parent 24b7726 commit c30149e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Experiments/
_build/
bin/

#Magnus specific
docker/*

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
30 changes: 28 additions & 2 deletions utils/models/magnus_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,34 @@


class MagnusModel(nn.Module):
def __init__(self):
def __init__(self,
imgsize: int,
channels: int,
n_classes:int=10):
super().__init__()
self.imgsize = imgsize
self.channels = channels

self.layer1 = nn.Sequential(*([
nn.Linear(self.channels*self.imgsize*self.imgsize, 133),
nn.ReLU()
]))
self.layer2 = nn.Sequential(*([
nn.Linear(133, 133),
nn.ReLU()
]))
self.layer3 = nn.Sequential(*([
nn.Linear(133, n_classes),
nn.ReLU()
]))

def forward(self, x):
return
assert len(x.size) == 4

x = x.view(x.size(0), -1)

x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)

return x

0 comments on commit c30149e

Please sign in to comment.