prod¶
- tripy.prod(input: Tensor, dim: int | Sequence[int] | None = None, keepdim: bool = False) Tensor [source]¶
Returns a new tensor containing the product of the elements of the input tensor along the specified dimension.
- Parameters:
- Returns:
A new tensor.
- Return type:
Example
1input = tp.reshape(tp.arange(6, dtype=tp.float32), (2, 3)) 2output = tp.prod(input, 0)
>>> input tensor( [[0.0000, 1.0000, 2.0000], [3.0000, 4.0000, 5.0000]], dtype=float32, loc=gpu:0, shape=(2, 3)) >>> output tensor([0.0000, 4.0000, 10.0000], dtype=float32, loc=gpu:0, shape=(3,))