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

# sort(_:axis:name:)

Sorts the elements of the input tensor along the specified axis.

## Declaration

```swift
func sort(_ tensor: MPSGraphTensor, axis: Int, name: String?) -> MPSGraphTensor
```

## Parameters

- `tensor`: The input tensor
- `axis`: The tensor dimension over which you sort the tensor
- `name`: The name for the operation.

## Return Value

Return Value A valid MPSGraphTensor object
