ai.onnx.CumProd

ai.onnx · standard ONNX operator · ONNX opset ≥ 26

Description

Computes the cumulative product of input elements along a given axis. By default the product is inclusive (each output element is the product of all preceding elements including itself); setting exclusive to 1 shifts the window so the current element is excluded. Setting reverse to 1 performs the scan in the opposite direction along the axis.

See the ONNX CumProd spec for the reference semantics.

Inputs

Name Bind key Logical dtype Rank Shape Description Presence
x x T Input tensor to be scanned along the specified axis. required

Outputs

Name Bind key Logical dtype Rank Shape Description Presence
y y T same as x same as x Output tensor of the same shape and type as x containing the cumulative products. required

Runtime arguments

Name Kind Semantic Description Presence
axis i32 axis Axis along which to accumulate; negative values count from the back. required

Attributes

Default values (overridable per request):

Attribute Default Description
exclusive 0 If 1, returns the exclusive product: each output element is the product of all elements before it (not including itself); if 0, the current element is included.
reverse 0 If 1, performs the cumulative product in the reverse direction along the axis; if 0, proceeds in the forward direction.

Type constraints

Variable Allowed dtypes
T float32, float16, int32, uint32

Files

Use with @huggingface/kernels

The loader derives every required output's shape and logical dtype from the manifest contract and this call. It then allocates the result tensors automatically.

The version: 1 option selects the published kernel contract; it is independent of any operator opset, contrib since_version, or model version.

Replace each *Data placeholder with a typed array containing the corresponding input data.

import { getKernel } from "@huggingface/kernels";

const kernel = await getKernel("webgpu-kernels/ai.onnx.CumProd", { version: 1 });
const { y } = await kernel({ x: { data: xData, shape: [3] }, axis: 0 });
Downloads last month
-
kernel
webgpu
wgsl
apache-2.0
WebGPU

Requires WebGPU support. See the compatibility table.