Skip to main content

ClikaRT::ops::prod

function

prod()

Tensor prod(
    Tensor x,
    ClikaRT::Span<const std::int64_t> dims = {},
    bool keepdim = false,
    DataType dtype = DataType::Undefined
)

Product of x's elements over dims.

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

Empty dims multiplies every element. dtype widens the accumulation/output when set; the default keeps x's dtype.

Parameters

  • x: 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 x's dtype.

Returns: the reduced product; shape = x minus dims.

Throws

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

Declared in ClikaRT/compute/ops.h, line 4405