• Transposes the tf.Tensor. Permutes the dimensions according to perm.

    The returned tf.Tensor's dimension i will correspond to the input dimension perm[i]. If perm is not given, it is set to [n-1...0], where n is the rank of the input tf.Tensor. Hence by default, this operation performs a regular matrix transpose on 2-D input tf.Tensors.

    const a = tf.tensor2d([1, 2, 3, 4, 5, 6], [2, 3]);

    a.transpose().print(); // or tf.transpose(a)

    Type Parameters

    Parameters

    • x: TensorLike | T

      The tensor to transpose.

    • Optionalperm: number[]

      The permutation of the dimensions of a.

    • Optionalconjugate: boolean

      Will conjugate complex input if true.

    Returns T