Skip to content

Commit

Permalink
Always forward state for recurrent nets
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaixhin committed Jun 26, 2016
1 parent 6e66251 commit 626712b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Agent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ function Agent:observe(reward, rawObservation, terminal)
-- Choose action by ε-greedy exploration (even with bootstraps)
aIndex = torch.random(1, self.m)

-- Forward state anyway if recurrent
if self.recurrent then
self.policyNet:forward(state)
end

-- Reset saliency if action not chosen by network
if self.saliency then
self.saliencyMap:zero()
Expand Down
5 changes: 5 additions & 0 deletions async/QAgent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function QAgent:_init(opt, policyNet, targetNet, theta, targetTheta, atomic, sha
self.dTheta:zero()

self.doubleQ = opt.doubleQ
self.recurrent = opt.recurrent

self.epsilonStart = opt.epsilonStart
self.epsilon = self.epsilonStart
Expand Down Expand Up @@ -60,6 +61,10 @@ function QAgent:eGreedy(state, net)
end

if torch.uniform() < self.epsilon then
-- Forward state anyway if recurrent
if self.recurrent then
net:forward(state)
end
return torch.random(1,self.m)
end

Expand Down

0 comments on commit 626712b

Please sign in to comment.