mindspore.ops.unsorted_segment_prod
- mindspore.ops.unsorted_segment_prod(x, segment_ids, num_segments)[source]
Compute the product of the input tensor along segments.
The following figure shows the calculation process of unsorted_segment_prod:
Note
If the segment_id i is absent in the segment_ids, then output[i] will be filled with 1.
The segment_ids must be non-negative tensor.
- Parameters
- Returns
Tensor
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> x = mindspore.tensor([[1, 2, 3], [4, 5, 6], [4, 2, 1]]) >>> segment_ids = mindspore.tensor([0, 1, 0]) >>> num_segments = 2 >>> mindspore.ops.unsorted_segment_prod(x, segment_ids, num_segments) Tensor(shape=[2, 3], dtype=Int64, value= [[4, 4, 3], [4, 5, 6]])