---
title: "maxPooling4DReturnIndices(_:descriptor:name:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/maxpooling4dreturnindices(_:descriptor:name:)"
---

# maxPooling4DReturnIndices(_:descriptor:name:)

Creates a 4D max-pooling operation and returns the result tensor and the corresponding indices tensor.

## Declaration

```swift
func maxPooling4DReturnIndices(_ source: MPSGraphTensor, descriptor: MPSGraphPooling4DOpDescriptor, name: String?) -> [MPSGraphTensor]
```

## Parameters

- `source`: The source tensor on which pooling will be performed.
- `descriptor`: A pooling operation descriptor that specifies pooling window sizes, strides, dilation rates and paddings.
- `name`: The name for the operation.

## Return Value

Return Value An array of two MPSGraphTensors. The first tensor holds the result of max pool and the second tensor holds the corresponding indices.

## Discussion

Discussion In order to Computes the indices, returnIndicesMode of the descriptor must be set. The datatype of indices tensor can be set using returnIndicesDataType. If returnIndicesMode = MPSGraphPoolingReturnIndicesNone then only the first result MPSGraph returns will be valid and using the second result will assert.
