Skip to content

Commit

Permalink
avoid possible NaN error
Browse files Browse the repository at this point in the history
  • Loading branch information
ruiliLaMeilleure committed Oct 18, 2018
1 parent 4abdde1 commit ac3ae20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contents/10_A3C/A3C_discrete_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self, scope, globalAC=None):
self.c_loss = tf.reduce_mean(tf.square(td))

with tf.name_scope('a_loss'):
log_prob = tf.reduce_sum(tf.log(self.a_prob) * tf.one_hot(self.a_his, N_A, dtype=tf.float32), axis=1, keep_dims=True)
log_prob = tf.reduce_sum(tf.log(self.a_prob + 1e-5) * tf.one_hot(self.a_his, N_A, dtype=tf.float32), axis=1, keep_dims=True)
exp_v = log_prob * tf.stop_gradient(td)
entropy = -tf.reduce_sum(self.a_prob * tf.log(self.a_prob + 1e-5),
axis=1, keep_dims=True) # encourage exploration
Expand Down

0 comments on commit ac3ae20

Please sign in to comment.