pytorch-dqn icon indicating copy to clipboard operation
pytorch-dqn copied to clipboard

pytorch 0.2

Open SSARCandy opened this issue 7 years ago • 2 comments

I'm running pytorch 0.2,

and the code dqn_learn.py fail to work..

the error as follow

Traceback (most recent call last):
  File "ram.py", line 57, in <module>
    main(env)
  File "ram.py", line 46, in main
    target_update_freq=TARGER_UPDATE_FREQ,
  File "/auto/master05/ssarcandy/ttt/dqn_learn.py", line 213, in dqn_learing
    current_Q_values.backward(d_error.data.unsqueeze(1))
  File "/home/master/05/ssarcandy/.local/lib/python2.7/site-packages/torch/autograd/variable.py", line 156, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph, retain_variables)
  File "/home/master/05/ssarcandy/.local/lib/python2.7/site-packages/torch/autograd/__init__.py", line 98, in backward
    variables, grad_variables, retain_graph)
  File "/home/master/05/ssarcandy/.local/lib/python2.7/site-packages/torch/autograd/function.py", line 91, in apply
    return self._forward_cls.backward(self, *args)
  File "/home/master/05/ssarcandy/.local/lib/python2.7/site-packages/torch/autograd/_functions/tensor.py", line 566, in backward
    return grad_input.scatter_add_(ctx.dim, index, grad_output), None, None
  File "/home/master/05/ssarcandy/.local/lib/python2.7/site-packages/torch/autograd/variable.py", line 696, in scatter_add_
    return ScatterAdd.apply(self, dim, index, source, True)
  File "/home/master/05/ssarcandy/.local/lib/python2.7/site-packages/torch/autograd/_functions/tensor.py", line 605, in forward
    return input.scatter_add_(ctx.dim, index, source)
RuntimeError: invalid argument 3: Index tensor must have same dimensions as input tensor at /pytorch/torch/lib/THC/generic/THCTensorScatterGather.cu:198

SSARCandy avatar Sep 07 '17 21:09 SSARCandy

Thanks for your report. But I don't have the time to upgrade to pytorch 0.2 unfortunately. Can you check on #3 and see if the pr works?

hungtuchen avatar Sep 11 '17 13:09 hungtuchen

@SSARCandy : Pull and check #8. It should fix the error you got. Post back if it works or if you still have some issues.

praveen-palanisamy avatar Nov 01 '17 02:11 praveen-palanisamy