Solving NaN vlaues
IbrahimSobh opened this issue · 0 comments
IbrahimSobh commented
Dears
Dear @DMTSource
Sometimes NaN values appear and agent just collapses. I used the following code to solve this issue.
After policy ...
self.policy = slim.fully_connected(rnn_out,a_size,
activation_fn=tf.nn.softmax,
weights_initializer=normalized_columns_initializer(0.01),
biases_initializer=None)
just add this line (to prevent log(0) )
self.policy += 1e-7
This line should protect the following code ...
self.entropy = - tf.reduce_sum(self.policy * tf.log(self.policy))
self.policy_loss = -tf.reduce_sum(tf.log(self.responsible_outputs)*self.advantages)
If you have any comments and suggestions please share ...