code: def testEntropyGradient(self):
      def true_entropy_fn(logits):
          probabilities = tf.math.softmax(logits)
          log_probabilities = tf.math.log_softmax(logits)
          return -tf.reduce_sum(
              probabilities * log_probabilities, axis=-1
          )
  
      def categorical_entropy_fn(logits):
          categorical_distribution = categorical.Categorical(
              logits=logits, validate_args=True
          )
          return categorical_distribution.entropy()
  
      # works
      logits = tf.constant([[1.0, 2.0, 3.0], [2.0, 5.0, 1.0]])
      true_entropy, true_entropy_g = gradient.value_and_gradient(
          true_entropy_fn, [logits]
      )
      (
          categorical_entropy,
          categorical_entropy_g,
      ) = gradient.value_and_gradient(categorical_entropy_fn, [logits])
  
      res = self.evaluate(
          {
              "true_entropy": true_entropy,
              "categorical_entropy": categorical_entropy,
              "true_entropy_g": true_entropy_g,
              "categorical_entropy_g": categorical_entropy_g,
          }
      )
      self.assertAllClose(
          res["true_entropy"], res["categorical_entropy"]
      )
      self.assertAllClose(
          res["true_entropy_g"], res["categorical_entropy_g"]
      )
  
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import identity
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.util import deferred_tensor
label_desc: Use image node_id 18 for calling the CategoricalTest obj's underlying member method code with example usage: obj.testEntropyGradient() and returns: unknown, categorical_distribution