---
title: "argSort(axis:sortOrder:)"
framework: accelerate
role: symbol
role_heading: Instance Method
path: "accelerate/bnnsgraph/builder/tensor/argsort(axis:sortorder:)"
---

# argSort(axis:sortOrder:)

Adds an argsort operation to the current graph.

## Declaration

```swift
func argSort(axis: Int, sortOrder: BNNSGraph.Builder.SortOrder) -> BNNSGraph.Builder.Tensor<Int32>
```

## Parameters

- `axis`: The axis over which the operation performs the sort.
- `sortOrder`: The sort order, either ascending or descending.

## Discussion

Discussion This function returns the indices into selfordered by the corresponding values. For example, if self contains the values [1, 4, 2, 3], the ascending indices are [0, 2, 3, 1].
