1
0
mirror of https://github.com/gryf/coach.git synced 2025-12-17 11:10:20 +01:00

bug fix - preventing crashes when the probability of one of the actions is 0 in the policy head

This commit is contained in:
Itai Caspi
2017-10-31 10:49:50 +02:00
parent 1918f16079
commit 913ab75e8a
4 changed files with 5 additions and 3 deletions

View File

@@ -177,7 +177,8 @@ class PolicyHead(Head):
self.policy_mean = tf.nn.softmax(policy_values, name="policy")
# define the distributions for the policy and the old policy
self.policy_distribution = tf.contrib.distributions.Categorical(probs=self.policy_mean)
# (the + eps is to prevent probability 0 which will cause the log later on to be -inf)
self.policy_distribution = tf.contrib.distributions.Categorical(probs=(self.policy_mean + eps))
self.output = self.policy_mean
else:
# mean