File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed
Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change 1- import pytest
2- import torch
31import torch .nn as nn
42
53"""
97# class NeuronLayer(nn.Module):
108# def __init__(self, in_features, out_features):
119# super().__init__()
12-
10+
1311# self.fc = nn.Linear(in_features, out_features)
1412# self.relu = nn.ReLU()
15-
13+
1614# def forward(self, x):
1715# x = self.fc(x)
1816# x = self.relu(x)
1917# return x
20-
18+
19+
2120class JohanModel (nn .Module ):
2221 """Small MLP model for image classification.
2322
@@ -27,30 +26,30 @@ class JohanModel(nn.Module):
2726 Numer of input features.
2827 num_classes : int
2928 Number of classes in the dataset.
30-
29+
3130 """
31+
3232 def __init__ (self , in_features , num_classes ):
3333 super ().__init__ ()
34-
34+
3535 self .fc1 = nn .Linear (in_features , 77 )
3636 self .fc2 = nn .Linear (77 , 77 )
3737 self .fc3 = nn .Linear (77 , 77 )
3838 self .fc4 = nn .Linear (77 , num_classes )
3939 self .softmax = nn .Softmax (dim = 1 )
4040 self .relu = nn .ReLU ()
41-
41+
4242 def forward (self , x ):
4343 for layer in [self .fc1 , self .fc2 , self .fc3 , self .fc4 ]:
4444 x = layer (x )
4545 x = self .relu (x )
4646 x = self .softmax (x )
4747 return x
48-
49-
50-
51- #TODO
48+
49+
50+ # TODO
5251# Add your tests here
5352
5453
55- if __name__ == "__main__" :
56- pass # Add your tests here
54+ if __name__ == "__main__" :
55+ pass # Add your tests here
You can’t perform that action at this time.
0 commit comments