From 677b1c85ae9b0b54db70750103d4c28e1b292404 Mon Sep 17 00:00:00 2001 From: Alok Singh <8325708+alok@users.noreply.github.com> Date: Wed, 2 May 2018 22:06:05 -0700 Subject: [PATCH] keep_dims -> keepdims (#1980) keep_dims is deprecated. --- python/ray/rllib/models/action_dist.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python/ray/rllib/models/action_dist.py b/python/ray/rllib/models/action_dist.py index 03e88bd1f..14b058488 100644 --- a/python/ray/rllib/models/action_dist.py +++ b/python/ray/rllib/models/action_dist.py @@ -43,21 +43,21 @@ class Categorical(ActionDistribution): def entropy(self): a0 = self.inputs - tf.reduce_max(self.inputs, reduction_indices=[1], - keep_dims=True) + keepdims=True) ea0 = tf.exp(a0) - z0 = tf.reduce_sum(ea0, reduction_indices=[1], keep_dims=True) + z0 = tf.reduce_sum(ea0, reduction_indices=[1], keepdims=True) p0 = ea0 / z0 return tf.reduce_sum(p0 * (tf.log(z0) - a0), reduction_indices=[1]) def kl(self, other): a0 = self.inputs - tf.reduce_max(self.inputs, reduction_indices=[1], - keep_dims=True) + keepdims=True) a1 = other.inputs - tf.reduce_max(other.inputs, reduction_indices=[1], - keep_dims=True) + keepdims=True) ea0 = tf.exp(a0) ea1 = tf.exp(a1) - z0 = tf.reduce_sum(ea0, reduction_indices=[1], keep_dims=True) - z1 = tf.reduce_sum(ea1, reduction_indices=[1], keep_dims=True) + z0 = tf.reduce_sum(ea0, reduction_indices=[1], keepdims=True) + z1 = tf.reduce_sum(ea1, reduction_indices=[1], keepdims=True) p0 = ea0 / z0 return tf.reduce_sum(p0 * (a0 - tf.log(z0) - a1 + tf.log(z1)), reduction_indices=[1])