I am trying to test multiple different models of an MLP (dropouts or no dropouts, depth, size of layers) and was thinking instead of manually creating a different MLP for each run I would add if logics when defining my nn architecture, such as this snippet;
#Define Forwards Pass
def forward(self, x):
if Dropout = 0:
if num_of_layers = 4:
# flatten image input
x = x.view(-1,28*28)
x = self.fc1(x)
x = F.relu(x)enter code here
Does pytorch let you do such a thing, because I got a Syntax Error for my first if statement?
Aucun commentaire:
Enregistrer un commentaire