MCPcopy Create free account
hub / github.com/modAL-python/modAL / Torch_Model

Class Torch_Model

examples/pytorch_integration.py:18–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16
17# build class for the skorch API
18class 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…