code: def test_markov_chain_stationary(self):
      n_steps = 52
      initial_prob = tf.constant([0.6, 0.4], dtype=tf.float64)
      transition_matrix = tf.constant(
          [[0.6, 0.4], [0.3, 0.7]], dtype=tf.float64
      )
  
      def model():
          i = yield Root(
              categorical.Categorical(
                  probs=initial_prob, dtype=tf.int32
              )
          )
  
          for t in range(n_steps - 1):
              i = yield categorical.Categorical(
                  probs=tf.gather(transition_matrix, i), dtype=tf.int32
              )
  
          yield deterministic.Deterministic(i)
  
      dist = marginalize.MarginalizableJointDistributionCoroutine(model)
      # Compute probability of ending in state 1 by marginalizing out
      # all intermediate states.
      # Limiting distribution as `n_steps` -> infinity is exactly 4/7.
      observations = n_steps * ["marginalize"] + [1]
      p = tf.exp(
          dist.marginalized_log_prob(
              observations, internal_type=tf.float64
          )
      )
      self.assertAllClose(p, 4.0 / 7.0)
  
imports: import functools
  import itertools
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import bernoulli
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import deterministic
  from tensorflow_probability.python.distributions import hidden_markov_model
  from tensorflow_probability.python.distributions import joint_distribution_coroutine
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import poisson
  from tensorflow_probability.python.distributions import sample
  import tensorflow_probability.python.experimental.marginalize
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 6 for calling the _MarginalizeTest obj's underlying member method code with example usage: obj.test_markov_chain_stationary() without return types