code: def test_computes_same_log_acceptance_correction_with_sharded_state(
      self,
  ):
      if not JAX_MODE:
          self.skipTest(
              "Test in TF runs into `merge_call` error: see b/178944108"
          )
  
      def target_log_prob(a, b):
          return normal.Normal(0.0, 1.0).log_prob(
              a
          ) + distribute_lib.psum(
              normal.Normal(
                  distribute_lib.pbroadcast(a, "foo"), 1.0
              ).log_prob(b),
              "foo",
          )
  
      kernel = langevin.MetropolisAdjustedLangevinAlgorithm(
          target_log_prob, step_size=1.9
      )
      sharded_kernel = kernel.experimental_with_shard_axes(
          [None, ["foo"]]
      )
  
      def run(seed):
          state = [tf.convert_to_tensor(0.0), tf.convert_to_tensor(0.0)]
          kr = sharded_kernel.bootstrap_results(state)
          _, kr = sharded_kernel.one_step(state, kr, seed=seed)
          return kr.proposed_results.log_acceptance_correction
  
      log_acceptance_correction = self.evaluate(
          self.per_replica_to_tensor(
              self.strategy_run(
                  run,
                  args=(samplers.zeros_seed(),),
                  in_axes=None,
                  axis_name="foo",
              ),
              0,
          )
      )
  
      for i in range(distribute_test_lib.NUM_DEVICES):
          self.assertAllClose(
              log_acceptance_correction[i], log_acceptance_correction[0]
          )
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import mvn_tril
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import distribute_lib
  from tensorflow_probability.python.internal import distribute_test_lib
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.mcmc import langevin
  from tensorflow_probability.python.mcmc import sample
label_desc: Use image node_id 2 for calling the DistributedLangevinTest obj's underlying member method code with example usage: obj.test_computes_same_log_acceptance_correction_with_sharded_state() and returns: unknown, kr