transposed(permutation:)
Permutes the dimensions of the tensor in the specified order.
Declaration
func transposed(permutation: Int...) -> MLTensorParameters
- permutation:
An array of integers defining the permutation, must be of length
rankand define a valid permutation.
Return Value
A permuted tensor.
Discussion
For example:
let x = MLTensor(shape: [1, 2, 3], scalars: [1, 2, 3, 4, 5, 6], scalarType: Float.self)
let y = x.transposed(1, 0, 2)
y.shape // is [2, 1, 3]