kashif / firedup

Clone of OpenAI's Spinning Up in PyTorch
MIT License
146 stars 25 forks source link

ddpg torch error #11

Closed geyang closed 2 years ago

geyang commented 4 years ago

Hi @kashif, thanks for making this available!

The DDPG implementation currently gives me this following error:

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [300, 1]], which is output 0 of TBackward, is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

I am on torch version

torch                             1.6.0
torchvision                       0.5.0
kashif commented 4 years ago

thanks @geyang for your kind words! I appreciate it. I too noticed this error when upgrading torch (in another project). Let me investigage and get back to you!

geyang commented 4 years ago

:) I reordered the two gradient update and it worked. However, would love to know why this is happening :)

kashif commented 2 years ago

fixed b658ae505815d2df7049bf3d02084aa01c06c220