MCPcopy Create free account
hub / github.com/circuitnet/CircuitNet / MLP

Class MLP

net_delay_prediction/model.py:6–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4import dgl.function as fn
5
6class MLP(torch.nn.Module):
7 def __init__(self, *sizes, batchnorm=False):
8 super().__init__()
9 fcs = []
10 for i in range(1, len(sizes)):
11 fcs.append(torch.nn.Linear(sizes[i - 1], sizes[i]))
12 if i < len(sizes) - 1:
13 fcs.append(torch.nn.LeakyReLU(negative_slope=0.2))
14 if batchnorm: fcs.append(torch.nn.BatchNorm1d(sizes[i]))
15 self.layers = torch.nn.Sequential(*fcs)
16
17 def forward(self, x):
18 return self.layers(x)
19
20class NetConv(torch.nn.Module):
21 def __init__(self, in_nf, in_ef, out_nf, h1=16, h2=16):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected