---
title: "ClikaRT::ops::cumprod"
sidebar_label: "cumprod"
description: "Cumulative product along dim (inclusive scan). \\[ \\mathrm{out}_k = \\prod_{j \\le k} x_j \\] input the input tensor. dim the axis to scan along. dtype output dtype; Undefined keeps input's dtype."
---

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

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

## cumprod() {#cumprod}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`cumprod`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`int64_t` `dim`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`DataType`](../../index.md#DataType) `dtype` `=` [`DataType::Undefined`](../../index.md#DataType)<br />
)

</div>

Cumulative product along `dim` (inclusive scan).

$$
\mathrm{out}_k = \prod_{j \le k} x_j
$$

**Parameters**

- `input`: the input tensor.
- `dim`: the axis to scan along.
- `dtype`: output dtype; `Undefined` keeps `input`'s dtype.

**Returns:** the scanned tensor, same shape as `input`.

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) when `dim` is out of range.

<div class="api-declared">

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

</div>
