| 16 | |
| 17 | # build class for the skorch API |
| 18 | class Torch_Model(nn.Module): |
| 19 | def __init__(self,): |
| 20 | super(Torch_Model, self).__init__() |
| 21 | self.convs = nn.Sequential( |
| 22 | nn.Conv2d(1,32,3), |
| 23 | nn.ReLU(), |
| 24 | nn.Conv2d(32,64,3), |
| 25 | nn.ReLU(), |
| 26 | nn.MaxPool2d(2), |
| 27 | nn.Dropout(0.25) |
| 28 | ) |
| 29 | self.fcs = nn.Sequential( |
| 30 | nn.Linear(12*12*64,128), |
| 31 | nn.ReLU(), |
| 32 | nn.Dropout(0.5), |
| 33 | nn.Linear(128,10), |
| 34 | ) |
| 35 | |
| 36 | def forward(self, x): |
| 37 | out = x |
| 38 | out = self.convs(out) |
| 39 | out = out.view(-1,12*12*64) |
| 40 | out = self.fcs(out) |
| 41 | return out |
| 42 | |
| 43 | |
| 44 | # create the classifier |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…