---
title: "transposed(permutation:)"
framework: coreml
role: symbol
role_heading: Instance Method
path: "coreml/mltensor/transposed(permutation:)"
---

# transposed(permutation:)

Permutes the dimensions of the tensor in the specified order.

## Declaration

```swift
func transposed(permutation: Int...) -> MLTensor
```

## Parameters

- `permutation`: An array of integers defining the permutation, must be of length rank and define a valid permutation.

## Return Value

Return Value A permuted tensor.

## Discussion

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]

## See Also

### Transposing the tensor

- [transposed()](coreml/mltensor/transposed().md)
