import tensorflow as tf

            name='rightmost_transposed_ndims')
        rightmost_transposed_ndims_ = tf.get_static_value(
            rightmost_transposed_ndims)
        with tf.control_dependencies(_maybe_validate_rightmost_transposed_ndims(
            rightmost_transposed_ndims, validate_args)):
          rightmost_transposed_ndims = tf.identity(rightmost_transposed_ndims)
        perm = tf.range(
            start=rightmost_transposed_ndims - 1,
            limit=-1,
            delta=-1,
            name='perm')
      else:  # perm is not None:
        perm = tf.convert_to_tensor(value=perm, dtype=np.int32, name='perm')
        rightmost_transposed_ndims = tf.size(
            input=perm, name='rightmost_transposed_ndims')
        rightmost_transposed_ndims_ = tf.get_static_value(
            rightmost_transposed_ndims)
        with tf.control_dependencies(_maybe_validate_perm(perm, validate_args)):
          perm = tf.identity(perm)

      # TODO(b/110828604): If bijector base class ever supports dynamic
      # `min_event_ndims`, then this class already works dynamically and the
      # following five lines can be removed.
      if rightmost_transposed_ndims_ is None:
