ymwangg commented on a change in pull request #7562:
URL: https://github.com/apache/tvm/pull/7562#discussion_r585874296
##########
File path: python/tvm/relay/op/transform.py
##########
@@ -1450,6 +1450,61 @@ def sparse_reshape(sparse_indices, prev_shape,
new_shape):
return TupleWrapper(_make.sparse_reshape(sparse_indices, prev_shape,
new_shape), 2)
+def segment_sum(data, indices, num_segments=None):
+ """
+ Computes the sum along segments of a tensor. This op is much better
understood with
+ visualization articulated in the following links and examples at the end
of this docstring.
+
+
https://www.tensorflow.org/api_docs/python/tf/raw_ops/UnsortedSegmentSum?hl=fr
+
https://caffe2.ai/docs/sparse-operations.html#null__unsorted-segment-reduction-ops
+
+ Parameters
+ ----------
+ data : relay.Expr
+ Input floating point data
+ indices : relay.Expr
+ A 1-D tensor containing the indices of the rows to calculate the
output sum upon.
+ This tensor doesn't need to be sorted
+ num_segments : Optional[int]
+ An integer describing the shape of the zeroth dimension. If
unspecified, its calculated
Review comment:
```suggestion
An integer describing the shape of the zeroth dimension. If
unspecified, it calculates
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]