code: def testDistributionBatchSlicing(self):
      batch_shape = [4, 3]
      seed0, seed1 = samplers.split_seed(test_util.test_seed(), 2)
      log_precision = tf.Variable(
          samplers.normal(batch_shape, seed=seed0)
      )
      mean_times_precision = tf.Variable(
          samplers.normal(batch_shape, seed=seed1)
      )
  
      def normal_from_natural(log_precision, mean_times_precision):
          variance = 1.0 / tf.exp(log_precision)
          mean = mean_times_precision * variance
          return normal.Normal(loc=mean, scale=tf.sqrt(variance))
  
      dist = deferred_module.DeferredModule(
          normal_from_natural, log_precision, mean_times_precision
      )
      self.assertLen(dist.trainable_variables, 2)
  
      sliced = dist[:2]
      self.assertEqual(sliced.batch_shape, [2, 3])
      # We do *not* expect the slicing itself to be deferred: like log_prob,
      # sample, and other methods, slicing produces a concrete value (that happens
      # to be a Distribution instance).
      self.assertLen(sliced.trainable_variables, 0)
  
      sliced_sample = sliced.sample(5)
      self.assertEqual(sliced_sample.shape, [5, 2, 3])
  
file_path: probability/tensorflow_probability/python/experimental/util/deferred_module_test.py
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import scale
  from tensorflow_probability.python.distributions import gamma
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import sample
  from tensorflow_probability.python.distributions import transformed_distribution
  from tensorflow_probability.python.experimental.util import deferred_module
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 3 for calling the DeferredModuleTest obj's underlying member method code with example usage: obj.testDistributionBatchSlicing() and returns: normal