Contents

transposed()

Returns a new transposed shaped array.

Declaration

func transposed() -> MLShapedArray<Scalar>

Discussion

This is equivalent to transposed(permutation:) where permutation: parameter is [shape.count-1, shape.count-2, ..., 0], which reverses the shape.

let original = MLShapedArray<Int32>(scalars: 0..., shape: [1, 2, 3])
let transposed = original.transposed()
transposed.shape // [3, 2, 1]

See Also

Shaping the array