class_docstr: Tests correctness of the `Transpose` bijector.
class_docstr_tok: ["Tests","correctness","of","the","`","Transpose","`","bijector","."]
code: def testTransposeFromEventNdim(self):
      rightmost_transposed_ndims_ = np.array(2, dtype=np.int32)
      actual_x_ = np.array(
          [
              [[1, 2], [3, 4]],
              [[5, 6], [7, 8]],
          ],
          dtype=np.float32,
      )
      actual_y_ = np.array(
          [
              [[1, 3], [2, 4]],
              [[5, 7], [6, 8]],
          ],
          dtype=np.float32,
      )
      if self.is_static:
          actual_x = tf.constant(actual_x_)
          actual_y = tf.constant(actual_y_)
          rightmost_transposed_ndims = tf.constant(
              rightmost_transposed_ndims_
          )
      else:
          actual_x = tf1.placeholder_with_default(actual_x_, shape=None)
          actual_y = tf1.placeholder_with_default(actual_y_, shape=None)
          rightmost_transposed_ndims = tf.constant(
              rightmost_transposed_ndims_
          )
  
      bijector = transpose.Transpose(
          rightmost_transposed_ndims=rightmost_transposed_ndims,
          validate_args=True,
      )
      y = bijector.forward(actual_x)
      x = bijector.inverse(actual_y)
      fldj = bijector.forward_log_det_jacobian(x, event_ndims=2)
      ildj = bijector.inverse_log_det_jacobian(y, event_ndims=2)
  
      [y_, x_, ildj_, fldj_] = self.evaluate([y, x, ildj, fldj])
  
      self.assertStartsWith(bijector.name, "transpose")
      self.assertAllEqual(actual_y, y_)
      self.assertAllEqual(actual_x, x_)
      self.assertAllEqual(0.0, ildj_)
      self.assertAllEqual(0.0, fldj_)
  
imports: import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.bijectors import transpose
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 2 for calling the _TransposeBijectorTest obj's underlying member method code with example usage: obj.testTransposeFromEventNdim() without return types