masahi commented on a change in pull request #7441:
URL: https://github.com/apache/tvm/pull/7441#discussion_r581457533



##########
File path: python/tvm/relay/op/transform.py
##########
@@ -1463,3 +1463,48 @@ def cumsum(data, axis=None, dtype=None, exclusive=None):
         -> [1, 1, 2, 2, 3, 4, 4]
     """
     return _make.cumsum(data, axis, dtype, exclusive)
+
+
+def unique(data, is_sorted=True, return_counts=False):
+    """
+    Find the unique elements of a tensor
+    Parameters
+    ----------
+    data : relay.Expr
+        A 1-D tensor of integers
+    sorted : bool
+        Whether to sort the unique elements in ascending order before 
returning as output
+    return_counts : bool
+        Whether to return the array with count of each unique element
+    Returns
+    -------
+    output : relay.Expr
+        A 1-D tensor containing the unique elements of the input data tensor
+    indices : relay.Expr
+        A 1-D tensor containing the index of each data element in the output 
tensor
+    num_unique : relay.Expr
+        A 0-D tensor containing the number of unique elements in the input 
data tensor
+    counts (optional) : relay.Expr
+        A 1-D tensor containing the count of each unique element in the output
+    Examples
+    --------

Review comment:
       Please mention that the outputs after `num_unique` are undefined. 




----------------------------------------------------------------
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]


Reply via email to