<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/BNNSGraph/Builder/Tensor/argSort(axis:sortOrder:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate9BNNSGraphO7BuilderV6TensorV7argSort4axis9sortOrderAGy__s5Int32VGSi_AE0fI0OtF"
  },
  "title" : "argSort(axis:sortOrder:)"
}
-->

# argSort(axis:sortOrder:)

Adds an argsort operation to the current graph.

```
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

This function returns the indices into `self`ordered by the corresponding values.

For example, if `self` contains the values `[1, 4, 2, 3]`, the ascending indices
are `[0, 2, 3, 1]`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)