code: def test_expected_grads_gives_gradients(self):
      x = tf.random.stateless_normal((3, 10000, 16), seed=(0, 0))
      indexes = tf.cast(
          10
          * tf.random.stateless_uniform((3, 10000, 16, 3), seed=(0, 0)),
          tf.float32,
      )
      em = universal.UniversalIndexedEntropyModel(
          uniform_noise.NoisyLogisticMixture,
          index_ranges=(10, 10, 5),
          parameter_fns=dict(
              loc=lambda i: i[..., 0:2] - 5,
              scale=lambda _: 1,
              weight=lambda i: tf.nn.softmax(
                  (i[..., 2:3] - 2) * [-1, 1]
              ),
          ),
          coding_rank=2,
          expected_grads=True,
      )
      self.assertTrue(em._expected_grads)
      with tf.GradientTape(persistent=True) as g:
          g.watch((x, indexes))
          x2, bits = em(x, indexes)
      self.assertIsInstance(g.gradient(x2, x), tf.Tensor)
      self.assertIsInstance(g.gradient(bits, x), tf.Tensor)
      self.assertIsInstance(g.gradient(bits, indexes), tf.Tensor)
      self.assertIsNone(g.gradient(x2, indexes))
  
imports: from absl.testing import parameterized
  import scipy.stats
  import tensorflow
  import tensorflow_probability
  from tensorflow_compression.python.distributions import deep_factorized
  from tensorflow_compression.python.distributions import uniform_noise
  from tensorflow_compression.python.entropy_models import universal
label_desc: Use image node_id 14 for calling the UniversalIndexedEntropyModelTest obj's underlying member method code with example usage: obj.test_expected_grads_gives_gradients() without return types