Thank you for your reply mr.albanD.
I have trained the model with dropout=0, loss for train and eval modes are around 0.04, but for model with dropout=0.5, loss in train mode is 0.09 and loss in eval mode is 0.63 (during evaluation for dropout=0.5, if I put the model in train mode with torch.no_grad() loss drops to 0.09).
My intention for asking this question was to get an understanding for this behavior. As I understand it, dropout helps prevent overfitting (granted, dropout is not needed in this case, because I am randomly generating training and test data).
Why is there such large difference in loss between train() mode and eval() mode for dropout=0.5?