Function transpose

  • Re-arrange the layout of the values within a Tensor. There is a method version of this static function: Tensor.transpose.


    The total number of elements of the tensor does not change.


      const t = sm.rand([128, 8])

    // equivalent calls
    const a = t.transpose([1, 0])
    a.shape // [8, 128]
    const b = sm.transpose(t, [1, 0])
    b.shape // [8, 128]


    A new Tensor


    • tensor: Tensor

      Tensor to transpose

    • axes: BigInt64Array | number[]

      The new order of the indices of the current axes after tranposing

    Returns Tensor

Generated using TypeDoc