---
title: "gatherAlongAxis(indices:axis:)"
framework: accelerate
role: symbol
role_heading: Instance Method
path: "accelerate/bnnsgraph/builder/tensor/gatheralongaxis(indices:axis:)"
---

# gatherAlongAxis(indices:axis:)

Adds a gather-along-axis operation to the current graph.

## Declaration

```swift
func gatherAlongAxis(indices: some BNNSGraph.Builder.OperationParameter<Int32>, axis: Int) -> BNNSGraph.Builder.Tensor<T>
```

## Parameters

- `indices`: The indices that the operation gathers.
- `axis`: The axis over which the operation gathers.

## Discussion

Discussion Register a gather along axis op, which shuffles the input along one axis. In particular, output y such that `y[L…, i, T…] = x[L…, indices[L…, i, T…], T…].
