MCPcopy Create free account
hub / github.com/ICTMCG/FakeSV / MLP

Class MLP

code/models/TikTec.py:4–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2from torch import nn
3
4class MLP(nn.Module):
5 def __init__(self, input_dim, hidden_dims, output_dim, dropout):
6 super(MLP, self).__init__()
7 layers = list()
8 curr_dim = input_dim
9 for hidden_dim in hidden_dims:
10 layers.append(nn.Linear(curr_dim, hidden_dim))
11 layers.append(nn.BatchNorm1d(hidden_dim))
12 layers.append(nn.ReLU())
13 layers.append(nn.Dropout(p=dropout))
14 curr_dim = hidden_dim
15 layers.append(nn.Linear(curr_dim, output_dim))
16 self.mlp = nn.Sequential(*layers)
17
18 def forward(self, input):
19 return self.mlp(input)
20
21class MaskAvg(nn.Module):
22 def __init__(self):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected