helion.language.cumprod

helion.language.cumprod(input_tensor, dim, reverse=False)[source]

Compute the cumulative product along a specified dimension.

Equivalent to hl.associative_scan(torch.mul, input_tensor, dim, reverse).

Parameters:
  • input_tensor (Tensor) – Input tensor to compute cumulative product

  • dim (int) – The dimension along which to compute cumulative product

  • reverse (bool) – If True, performs the cumprod in reverse order

Returns:

Tensor with same shape as input containing cumulative product

Return type:

torch.Tensor

See also

Note

  • Output has same shape as input

  • Reverse=True computes cumprod from right to left

  • Equivalent to torch.cumprod