code: def test_docstring_example_batch_gaussian_walk(
      self, float_dtype, use_dynamic_shapes
  ):
      if tf.executing_eagerly() and use_dynamic_shapes:
          self.skipTest("No dynamic shapes in eager mode.")
  
      def _as_tensor(x, dtype=None):
          x = ps.cast(x, dtype=dtype if dtype else float_dtype)
          if use_dynamic_shapes:
              x = tf1.placeholder_with_default(x, shape=None)
          return x
  
      scales = _as_tensor([0.5, 0.3, 0.2, 0.2, 0.3, 0.2, 0.7])
      batch_gaussian_walk = markov_chain_lib.MarkovChain(
          # The prior distribution determines the batch shape for the chain.
          # Transitions must respect this batch shape.
          initial_state_prior=normal.Normal(
              loc=_as_tensor([-10.0, 0.0, 10.0]),
              scale=_as_tensor([1.0, 1.0, 1.0]),
          ),
          transition_fn=lambda t, x: normal.Normal(  # pylint: disable=g-long-lambda
              loc=x,
              # The `num_steps` dimension will always be leftmost in `x`, so we
              # pad the scale to the same rank as `x` so that the shapes line up.
              scale=tf.reshape(
                  tf.gather(scales, t),
                  ps.concat(
                      [[-1], ps.ones(ps.rank(x) - 1, dtype=tf.int32)],
                      axis=0,
                  ),
              ),
          ),
          # Limit to eight steps since we only specified scales for seven
          # transitions.
          num_steps=8,
      )
      self.assertAllEqual(batch_gaussian_walk.event_shape_tensor(), [8])
      self.assertAllEqual(batch_gaussian_walk.batch_shape_tensor(), [3])
  
      x = batch_gaussian_walk.sample(5, seed=test_util.test_seed())
      self.assertAllEqual(ps.shape(x), [5, 3, 8])
      lp = batch_gaussian_walk.log_prob(x)
      self.assertAllEqual(ps.shape(lp), [5, 3])
  
      x2, lp2 = batch_gaussian_walk.experimental_sample_and_log_prob(
          [2], seed=test_util.test_seed()
      )
      self.assertAllClose(lp2, batch_gaussian_walk.log_prob(x2))
  
imports: from absl.testing import parameterized
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import reshape
  from tensorflow_probability.python.bijectors import split
  from tensorflow_probability.python.distributions import deterministic
  from tensorflow_probability.python.distributions import dirichlet
  from tensorflow_probability.python.distributions import exponential
  from tensorflow_probability.python.distributions import gamma
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import inverse_gamma
  from tensorflow_probability.python.distributions import joint_distribution_auto_batched
  from tensorflow_probability.python.distributions import joint_distribution_named
  from tensorflow_probability.python.distributions import linear_gaussian_ssm
  from tensorflow_probability.python.distributions import log_prob_ratio
  from tensorflow_probability.python.distributions import markov_chain
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import mvn_tril
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import uniform
  from tensorflow_probability.python.distributions import wishart
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 4 for calling the MarkovChainTest obj's underlying member method code with example usage: obj.test_docstring_example_batch_gaussian_walk(float_dtype, use_dynamic_shapes) and returns: x