PacktPublishing / Deep-Reinforcement-Learning-Hands-On

Hands-on Deep Reinforcement Learning, published by Packt
MIT License
2.83k stars 1.28k forks source link

Ch. 17 lib/i2a.py using tensor with wrong type as an index #11

Closed stevenapsel closed 5 years ago

stevenapsel commented 5 years ago

While running 03_i2a.py, I get a runtime error on line 61 of lib/i2a.py: act_planes_v[range(batch_size), actions] = 1.0

actions is being used as an index, and the tensor types needs to be int or byte. To fix this, I made the following change on line 166: actions_t = torch.tensor(actions,dtype=torch.int64).to(batch.device)

I am now able to run without issues.

Shmuma commented 5 years ago

Fixed by PR12, thanks for reporting!