---
title: "transpose(_:permutation:name:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/transpose(_:permutation:name:)"
---

# transpose(_:permutation:name:)

Creates a permutation operation and returns the result tensor.

## Declaration

```swift
func transpose(_ tensor: MPSGraphTensor, permutation: [NSNumber], name: String?) -> MPSGraphTensor
```

## Parameters

- `tensor`: The tensor to be permuted.
- `permutation`: An array of numbers defining the permutation, must be of length rank(tensor) and define a valid permutation.
- `name`: The name for the operation.

## Return Value

Return Value A valid MPSGraphTensor object.

## Discussion

Discussion Permutes the dimensions of the input tensor according to values in permutation.
