code: def _compute_swap_notmatrix(before_positions, after_positions):
      """Determine which before_positions were equal to after_positions.
  
      Args:
        before_positions: Shape [n_replica,...] integer Tensor.  Replica positions
          before an swap.
        after_positions: Shape [n_replica,...] integer Tensor.  Replica positions
          after an swap.
  
      Returns:
        swaps: Shape [n_replica, n_replica, ...] boolean Tensor.
          swaps[i, j, ..] = True just when
          before_positions[i,...] == after_positions[j, ...].
      """
      with tf.name_scope("compute_swap_notmatrix"):
          # Which one is expanded doesn't matter for once-only swaps, since i --> j if
          # and only if j --> i.
          # Nonetheless, these are the correct expansions if general permutations are
          # allowed.
          return tf.equal(
              before_positions,
              after_positions[:, tf.newaxis],
          )
  
imports: import collections
  import warnings
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import broadcast_util
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import unnest
  from tensorflow_probability.python.mcmc import kernel
  from tensorflow_probability.python.mcmc.internal import util
label_desc: Use image node_id 8 for calling a global function with example usage: _compute_swap_notmatrix(before_positions, after_positions) and returns: tf