---
title: "gatherAlongAxisTensor(_:updates:indices:name:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/gatheralongaxistensor(_:updates:indices:name:)"
---

# gatherAlongAxisTensor(_:updates:indices:name:)

Creates a GatherAlongAxis operation and returns the result tensor.

## Declaration

```swift
func gatherAlongAxisTensor(_ axisTensor: MPSGraphTensor, updates updatesTensor: MPSGraphTensor, indices indicesTensor: MPSGraphTensor, name: String?) -> MPSGraphTensor
```

## Parameters

- `axisTensor`: Scalar Int32 tensor. The axis to gather from. Negative values wrap around
- `updatesTensor`: The input tensor to gather values from
- `indicesTensor`: Int32 or Int64 tensor used to index updatesTensor
- `name`: The name for the operation.

## Return Value

Return Value A valid MPSGraphTensor object

## Discussion

Discussion Gather values from updatesTensor along the specified axis at indices in indicesTensor. The shape of updatesTensor and indicesTensor must match except at axis. The shape of the result tensor is equal to the shape of indicesTensor. If an index is out of bounds of the updatesTensor along axis a 0 is inserted.
