MCPcopy Create free account
hub / github.com/Mattdl/ContinualPrototypeEvolution / MLP

Class MLP

model/common.py:22–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21
22class MLP(nn.Module):
23 def __init__(self, sizes, bias=True):
24 super(MLP, self).__init__()
25 layers = []
26
27 for i in range(0, len(sizes) - 1):
28
29 if i < (len(sizes) - 2):
30 layers.append(nn.Linear(sizes[i], sizes[i + 1]))
31
32 layers.append(nn.ReLU())
33 else:
34 layers.append(nn.Linear(sizes[i], sizes[i + 1], bias=bias))
35
36 self.net = nn.Sequential(*layers)
37 self.net.apply(Xavier)
38
39 def forward(self, x):
40 return self.net(x)
41
42
43def conv3x3(in_planes, out_planes, stride=1):

Callers 1

get_modelFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected