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

17 lines
1.0 KiB
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.isin
=================================
.. py:function:: mindspore.numpy.isin(element, test_elements, invert=False)
``test_elements`` 中的元素上计算,并仅在 ``element`` 上进行广播。返回一个与 ``element`` 形状相同的bool数组其中 ``element`` 的元素在 ``test_elements`` 中时为True否则为False。
.. note::
由于实现不依赖于输入数组的唯一性因此不支持NumPy的 ``assume_unique`` 参数。
参数:
- **element** (Union[int, float, bool, list, tuple, Tensor]) - 输入数组。
- **test_elements** (Union[int, float, bool, list, tuple, Tensor]) - 用于测试 ``element`` 中每个值的对比值。
- **invert** (boolean, 可选) - 如果为True返回数组中的值将取反相当于计算 ``element`` 不在 ``test_elements`` 中的情况。默认值: ``False``
返回:
Tensor``element`` 具有相同的shape。 ``element[isin]`` 的值在 ``test_elements`` 中。