---
title: "ClikaRT::ops::max_pool_with_indices"
sidebar_label: "max_pool_with_indices"
description: "Max pooling that also returns each window's winning element as a flat index over the input's spatial extents (per plane, the same for every channel). The values follow max_pool."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--function">function</span>

## max\_pool\_with\_indices() {#max_pool_with_indices}

<div class="api-signature">

`std::array<`[`Tensor`](../Tensor.md) `2>` **`max_pool_with_indices`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const std::int64_t>` `kernel_size`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const std::int64_t>` `stride`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const std::int64_t>` `padding`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const std::int64_t>` `dilation`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`bool` `ceil_mode`<br />
)

</div>

Max pooling that also returns each window's winning element as a flat index over the input's spatial extents (per plane, the same for every channel). The values follow [`max_pool`](./max_pool.md#max_pool). The index names the window's lowest-index NaN element when it holds one, else the first element holding the max (a tie keeps the lowest index); a window lying wholly in the padding reports -1.

**Returns:** a 2-element array \{values, indices\}; indices are Int64.

<div class="api-declared">

Declared in `ClikaRT/compute/ops.h`, line 4089

</div>
