I would remove the line output = self.dropout_layer(output) from the very end of the forward method of ModelNetwork. It doesn’t make any sense to me to apply dropout to the output layer. Also, while you are debugging this, try commenting out all calls to dropout layers.