sachindharashivkar / Doom-Agent

A3C Agent to perform various tasks in ViZDoom environment.
Apache License 2.0
1 stars 0 forks source link

error using net:reinforce(rew) and net:backward(state[j]) #1

Open Tord-Zhang opened 7 years ago

Tord-Zhang commented 7 years ago

First of all,thank you for your work. I am recently learning the code,but there are some error in those two lines. returns = rewards[j] + 0.99 * returns advantage = returns - values[j] --advantage net2:reinforce(advantage) net2:backward(states[j])

/home/zt/torch/install/share/lua/5.1/dpnn/Reinforce.lua:39: bad argument #1 to 'size' (dimension 1 out of range of 0D tensor at /home/zt/torch/pkg/torch/generic/Tensor.c:19) stack traceback: [C]: in function 'size' /home/zt/torch/install/share/lua/5.1/dpnn/Reinforce.lua:39: in function 'rewardAs' ...orch/install/share/lua/5.1/dpnn/ReinforceCategorical.lua:48: in function 'updateGradInput' /home/zt/torch/install/share/lua/5.1/nn/Module.lua:31: in function </home/zt/torch/install/share/lua/5.1/nn/Module.lua:29> [C]: in function 'xpcall' /home/zt/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors' /home/zt/torch/install/share/lua/5.1/nn/Sequential.lua:84: in function 'backward' [string "_RESULT={m:backward(data)}"]:1: in main chunk [C]: in function 'xpcall' /home/zt/torch/install/share/lua/5.1/trepl/init.lua:661: in function 'repl' ...e/zt/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:204: in main chunk [C]: at 0x00405d50

why this error occurs?How can I fix it?

sachindharashivkar commented 7 years ago

Hi Mangdian,

Apologies for the delayed response. I was away and did not pay attention to the github. I do not have this code set up, as of this moment. But I will set it up and try to replicate the error. I understand I need to to clean the code and Thanks for reading it.