---
title: "ClikaRT::ops::prod"
sidebar_label: "prod"
description: "Product of input's elements over dims. \\[ \\mathrm{out} = \\prod_{i \\in \\text{dims}} x_i \\] Empty dims multiplies every element."
---

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

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

## prod() {#prod}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`prod`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const std::int64_t>` `dims` `=` `{}`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`bool` `keepdim` `=` `false`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`DataType`](../../index.md#DataType) `dtype` `=` [`DataType::Undefined`](../../index.md#DataType)<br />
)

</div>

Product of `input`'s elements over `dims`.

$$
\mathrm{out} = \prod_{i \in \text{dims}} x_i
$$

Empty `dims` multiplies every element. [`dtype`](../dtype/index.md) widens the accumulation/output when set; the default keeps `input`'s dtype.

**Parameters**

- `input`: the input tensor.
- `dims`: axes to reduce; empty = all axes.
- `keepdim`: keep reduced axes as size-1 dims; default false.
- `dtype`: output dtype; `Undefined` keeps `input`'s dtype.

**Returns:** the reduced product; shape = `input` minus `dims`.

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) on an out-of-range `dims` entry.

<div class="api-declared">

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

</div>
