Getting this RuntimeError:Cudnn RNN backward can only be called in training mode

I’m using Pytorch 1.0 Pythn 3.7.3 Cuda 10.0 CudNn 7.5 got This ERROR

Traceback (most recent call last):
File “main.py”, line 96, in
main(args)
File “main.py”, line 70, in main
disc_loss, gen_loss = trainer.train_one_epoch_adversarial()
File “C:\Users\CSE495-NBM\Desktop\unmt_2\libs\trainer.py”, line 432, in train_one_epoch_adversarial
loss.backward()
File “C:\Users\CSE495-NBM\Miniconda3\lib\site-packages\torch\tensor.py”, line 107, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File “C:\Users\CSE495-NBM\Miniconda3\lib\site-packages\torch\autograd_init_.py”, line 93, in backward
allow_unreachable=True) # allow_unreachable flag
RuntimeError: cudnn RNN backward can only be called in training mode

Hi Sajid,

Could you post some of your code? Are you doing model.eval() at some point before calling backward?