[rllib] Add autoregressive KL (#5469)

This commit is contained in:
jon-chuang
2019-08-19 09:34:50 +03:00
committed by Eric Liang
parent 9d7e8c1173
commit 658e002cdf
+6 -2
View File
@@ -99,8 +99,12 @@ class BinaryAutoregressiveOutput(ActionDistribution):
return a1_dist.entropy() + a2_dist.entropy()
def kl(self, other):
# TODO: implement this properly
return tf.zeros_like(self.entropy())
a1_dist = self._a1_distribution()
a1_terms = a1_dist.kl(other._a1_distribution())
a1 = a1_dist.sample()
a2_terms = self._a2_distribution(a1).kl(other._a2_distribution(a1))
return a1_terms + a2_terms
def _a1_distribution(self):
BATCH = tf.shape(self.inputs)[0]