code: def check_swaps_with_no_batch_shape(self, swaps_, prob_swap):
      assert (
          swaps_.ndim == 2
      ), "Expected shape [num_results, num_replica]"
      num_results, num_replica = swaps_.shape
  
      null_swaps = np.arange(num_replica)
  
      # Check that we propose at least one swap, prob_swap fraction of the
      # time.
      # An exception is made for when num_replica == 1, since in this case the
      # only swap is the null swap.
      expected_prob_swap = prob_swap * np.float32(num_replica > 1)
      observed_prob_swap = np.mean(np.any(swaps_ != null_swaps, axis=1))
      self.assertAllClose(
          expected_prob_swap,
          observed_prob_swap,
          rtol=0,
          # Accurate to 4 standard errors.
          atol=4 * np.sqrt(prob_swap * (1 - prob_swap) / num_results),
      )
  
      # Verify the swap is "once only."
      for n in range(20):
          self.assertAllEqual(null_swaps, np.take(swaps_[n], swaps_[n]))
  
imports: from absl import logging
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import mixture_same_family
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import test_combinations
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.internal import unnest
  from tensorflow_probability.python.mcmc import diagnostic
  from tensorflow_probability.python.mcmc import hmc
  from tensorflow_probability.python.mcmc import random_walk_metropolis
  from tensorflow_probability.python.mcmc import replica_exchange_mc
  from tensorflow_probability.python.mcmc import sample
  from tensorflow_probability.python.mcmc import simple_step_size_adaptation
  from tensorflow_probability.python.stats import sample_stats
label_desc: Use image node_id 3 for calling the DefaultSwapProposedFnTest obj's underlying member method code with example usage: obj.check_swaps_with_no_batch_shape(swaps_, prob_swap) without return types