ttnn.experimental.cumprod

ttnn.experimental.cumprod = Operation(python_fully_qualified_name='ttnn.experimental.cumprod', function=<ttnn._ttnn.operations.experimental.cumprod_t object>, preprocess_golden_function_inputs=<function default_preprocess_golden_function_inputs>, golden_function=None, postprocess_golden_function_outputs=<function default_postprocess_golden_function_outputs>, is_cpp_operation=True, is_experimental=False)

ttnn.Tensor, dim: int) -> ttnn.Tensor

Returns a tensor witth cumulative product calculated along a given axis (dim).

Parameters:
  • input_tensor (ttnn.Tensor) – the input tensor to calculate cumulative product of.

  • dim (int) – axis of product cumulation.

Keyword Arguments:
  • queue_id (int, optional) – command queue’s ID, defaults to 0.

  • memory_config (ttnn.MemoryConfig, optional) – memory configuration for the operation. Defaults to None.

Returns:

ttnn.Tensor – the output tensor (for now, it is a copy of input_tensor, because only scaffold is implemented).

Example

>>> # return a ref
>>> tensor = ttnn.from_torch(torch.tensor((1, 2, 3), dtype=torch.bfloat16), device=device)
>>> # Note that the call below will output the same tensor it was fed for the time being,
>>> # until the actual implementation is provided.
>>> output = ttnn.experimental.cumprod(tensor, 1)
>>> assert tensor.shape == output.shape
>>> assert tensor.dtype == output.dtyoe
>>> # preallocation and return another ref
>>> tensor = ttnn.from_torch(torch.tensor((1, 2, 3), dtype=torch.uint8), device=device)
>>> # Note that the call below will output the same tensor it was fed for the time being,
>>> # until the actual implementation is provided.
>>> tensor_copy = ttnn.zeros_like(tensor)
>>> output = ttnn.experimental.cumprod(tensor, 1, out=tensor_copy)
>>> assert tensor.shape == output.shape
>>> assert tensor.dtype == output.dtype
>>> assert tensor.shape == output.shape
>>> assert tensor.dtype == output.dtyoe
Type:

cumprod(input_tensor