Skip to content

Commit 798944f

Browse files
vuoristoericl
authored andcommitted
Fixes Inconsistent weight assignment operations in DQNPolicyGraph (#4… (#4504)
* Fixes Inconsistent weight assignment operations in DQNPolicyGraph (#4502) * Update dqn_policy_graph.py
1 parent f4b313e commit 798944f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

python/ray/rllib/agents/dqn/dqn_policy_graph.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,9 @@ def __init__(self, observation_space, action_space, config):
431431
# update_target_fn will be called periodically to copy Q network to
432432
# target Q network
433433
update_target_expr = []
434-
for var, var_target in zip(
435-
sorted(self.q_func_vars, key=lambda v: v.name),
436-
sorted(self.target_q_func_vars, key=lambda v: v.name)):
434+
assert len(self.q_func_vars) == len(self.target_q_func_vars), \
435+
(self.q_func_vars, self.target_q_func_vars)
436+
for var, var_target in zip(self.q_func_vars, self.target_q_func_vars):
437437
update_target_expr.append(var_target.assign(var))
438438
self.update_target_expr = tf.group(*update_target_expr)
439439

0 commit comments

Comments
 (0)