Skip to content

Commit 83d6fec

Browse files
MdhvinceSvetlana Karslioglu
and
Svetlana Karslioglu
authored
update target network weight during episode after x timesteps (#2110)
Co-authored-by: Svetlana Karslioglu <svekars@fb.com>
1 parent 4c27a06 commit 83d6fec

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

intermediate_source/reinforcement_q_learning.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,10 @@ def optimize_model():
492492
episode_durations.append(t + 1)
493493
plot_durations()
494494
break
495-
# Update the target network, copying all weights and biases in DQN
496-
if i_episode % TARGET_UPDATE == 0:
497-
target_net.load_state_dict(policy_net.state_dict())
495+
496+
# Update the target network, copying all weights and biases in DQN
497+
if t % TARGET_UPDATE == 0:
498+
target_net.load_state_dict(policy_net.state_dict())
498499

499500
print('Complete')
500501
env.render()

0 commit comments

Comments
 (0)