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

18 lines
1021 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.ix\_
=================================
.. py:function:: mindspore.numpy.ix_(*args)
从多个序列构建一个开放式网格,用于索引的坐标数组。它接受 ``N`` 个一维整数数组作为输入,并返回 ``N`` 个输出,每个输出具有 ``N`` 个维度使得除了一个维度外所有维度的shape都是1并且具有非单位形状值的维度在所有N个维度上循环。表示用于索引多维数组的坐标。使用 ``ix_`` 可以快速构建索引数组,对叉乘进行索引。 ``a[np.ix_([1,3],[2,5])]`` 返回数组 ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``
.. note::
不支持布尔掩码。
参数:
- ***args** (Tensor) - 一维数组序列。
返回:
元素为Tensor的Tuple。 ``N`` 个序列,每个序列有 ``N`` 个维度,其中 ``N`` 是输入序列的数量。这些序列共同构成一个开放式网格。
异常:
- **TypeError** - 如果输入的数据类型不是 ``Tensor``