option-critic-pytorch icon indicating copy to clipboard operation
option-critic-pytorch copied to clipboard

loss.backward error

Open Zhaocka opened this issue 4 years ago • 3 comments

Hello when I download the code and run it in my computer, and I met an error in loss.backward() RuntimeError: one of the variables needed for gradient computaion has been modified by an inplace operation:[torch.FloatTensor [32, 64], which is output 0 of AsStrideBackward0, is at version 2; expected version 1 instead]

I didn't modify the code anywhere. my dependencies pytorch 1.3.0 python 3.6.13 tensorboard 2.0.2 gym 0.15.3

Zhaocka avatar Mar 22 '22 08:03 Zhaocka

@Zhaocka Hi Zhaocka, I have the same problem as you, have you solved the problem?

Shi-YiWei avatar Apr 02 '22 20:04 Shi-YiWei

Hey @Zhaocka, @Shi-YiWei, I am currently (slowly) working on a new version of this repository on the following branch: https://github.com/lweitkamp/option-critic-pytorch/tree/updated_oc. I could not find a way to remove the issue, so the codebase is completely rewritten. That version does converge for Cartpole-v0/v1 but I am trying to get a good parameter setting for Pong. Once that is found, I will merge the branch.

lweitkamp avatar Apr 04 '22 14:04 lweitkamp

The problem is in actor_loss. There are some problems with it's logp and entropy. But I don't know why.

Walker-9527 avatar Aug 05 '22 02:08 Walker-9527

The issue ended up being how I access the state variable which is a PyTorch tensor. The latest commit fixes the issue!

lweitkamp avatar Aug 17 '22 19:08 lweitkamp