Actually I am trying to create a different model (with linear layers) for different variables. That’s why I wrote one model and created k instances of that model where k is the number of variables.
Its not one linear layer for one variable !
My var model look like the following,
class var(nn.Module):
def init(self, input_size, hidden_size, num_classes, p=0.0, l=1):
super().init()
layers = []
for i in range(l):
if i == 0:
layers.append(nn.Linear(input_size, hidden_size))
layers.append(nn.Dropout(0.2))
else:
layers.append(nn.Linear(hidden_size, hidden_size))
layers.append(nn.Dropout(0.2))
self.net = nn.Sequential(*layers)
def forward(self, x):
out = self.net(x)
return out