mindspore2022/docs/api/api_python/ops/mindspore.ops.Gather.rst

25 lines
921 B
ReStructuredText
Raw 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.ops.Gather
======================
.. py:class:: mindspore.ops.Gather()
返回输入Tensor在指定 `axis``input_indices` 索引对应的元素组成的切片。
**输入:**
- **input_params** (Tensor) - 原始Tensorshape为 :math:`(x_1, x_2, ..., x_R)`
- **input_indices** (Tensor) - 要切片的索引Tensorshape为 :math:`(y_1, y_2, ..., y_S)` 。指定原始Tensor中要切片的索引。数据类型必须是int32或int64。
- **axis** (int) - 指定要切片的维度索引。
.. note::
input_indices的值必须在 `[0, input_param.shape[axis])` 范围内,超出该范围则报错。
**输出:**
Tensorshape为 :math:`input\_params.shape[:axis] + input\_indices.shape + input\_params.shape[axis + 1:]`
**异常:**
- **TypeError** - `axis` 不是int。
- **TypeError** - `input_indices` 不是int类型的Tensor。