If you cannot call retain_grad() on a variable if you run with torch.no_grad().
I guess your evaluation code has been changed?
Note that you can use torch.enable_grad() to enforce grad computation locally.