Commit 8ad7e2b4 authored by Yuxin Wu's avatar Yuxin Wu

fix scope bug in DQN. fix #108

parent e9da8f89
...@@ -124,8 +124,9 @@ class Model(ModelDesc): ...@@ -124,8 +124,9 @@ class Model(ModelDesc):
best_v = tf.reduce_max(targetQ_predict_value, 1) # N, best_v = tf.reduce_max(targetQ_predict_value, 1) # N,
else: else:
# Double-DQN # Double-DQN
tf.get_variable_scope().reuse_variables() sc = tf.get_variable_scope()
next_predict_value = self._get_DQN_prediction(next_state) with tf.variable_scope(sc, reuse=True):
next_predict_value = self._get_DQN_prediction(next_state)
self.greedy_choice = tf.argmax(next_predict_value, 1) # N, self.greedy_choice = tf.argmax(next_predict_value, 1) # N,
predict_onehot = tf.one_hot(self.greedy_choice, NUM_ACTIONS, 1.0, 0.0) predict_onehot = tf.one_hot(self.greedy_choice, NUM_ACTIONS, 1.0, 0.0)
best_v = tf.reduce_sum(targetQ_predict_value * predict_onehot, 1) best_v = tf.reduce_sum(targetQ_predict_value * predict_onehot, 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment