Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix for Train.lua #4

Closed
socurites opened this issue Mar 5, 2017 · 1 comment
Closed

Bug fix for Train.lua #4

socurites opened this issue Mar 5, 2017 · 1 comment

Comments

@socurites
Copy link

In Train.lua, there is one bug. At line 82, the code is as follows:
local target = model:forward(memoryInput.inputState)

        --Gives us Q_sa, the max q for the next state.
        local nextStateMaxQ = torch.max(model:forward(memoryInput.nextState), 1)[1]

As you can see, we call model:forward two times.
But after second call of model:forward, target tensor is also changed.
I don't know whether it's a bug of Torch or not.

To learn correctly, you should change above code at line 82 as follows:
local target = model:forward(memoryInput.inputState):clone()

After that when we learn Train.lua, we could see err is diminishing and WinCount is increasing more rapidly.

Anyway, I'd like to thank you for your endeavor. I learned a lot about RL from your code.

SeanNaren pushed a commit that referenced this issue Mar 5, 2017
@SeanNaren
Copy link
Owner

Thanks so much for the fix! Also am very glad this was useful for you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants