ttnn.prod

ttnn.prod(input_tensor: ttnn.Tensor, all_dimensions: bool | None = False, dim: int | None = 0, keepdim: bool | None = False, *, memory_config: ttnn.MemoryConfig | None = None) List of ttnn.Tensor

Computes the prod function along specified dim or all dimensions on the input tensor.

\[\begin{split}prod(\\mathrm{input\\_tensor}_i)\end{split}\]
Parameters:
  • input_tensor (ttnn.Tensor) – the input tensor.

  • all_dimensions (bool, optional) – prod along all dimensions. Defaults to False.

  • dim (int, optional) – Dimension to perform prod. Defaults to 0.

  • keepdim (bool, optional) – keep original dimension size. Defaults to False.

Keyword Arguments:

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

Returns:

List of ttnn.Tensor – the output tensor.

Example:

>>> tensor = ttnn.from_torch(torch.tensor((1, 2), dtype=torch.bfloat16), device=device)
>>> output = ttnn.prod(tensor)