mindspore/docs/api/api_python/numpy/mindspore.numpy.unique.rst

19 lines
790 B
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.numpy.unique
=================================
.. py:function:: mindspore.numpy.unique(x, return_inverse=False)
返回去重后的Tensor元素。当输入Tensor有多个维度时将首先将其展平。
.. note::
不支持Numpy的 ``axis````return_index````return_counts`` 参数。在CPU上该操作必须在图模式下执行。
参数:
- **x** (Tensor) - 要处理的输入Tensor。
- **return_inverse** (bool可选) - 如果为 ``True`` 还返回唯一Tensor的索引。默认值 ``False``
返回:
Tensor或Tensor的tuple。如果 ``return_inverse````False`` 返回唯一Tensor否则返回Tensor的tuple。
异常:
- **TypeError** - 如果 ``x`` 不是Tensor。