You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.ops.Gather.rst 1.3 kB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
1234567891011121314151617181920212223242526272829303132
  1. mindspore.ops.Gather
  2. ======================
  3. .. py:class:: mindspore.ops.Gather()
  4. 返回输入Tensor在指定 `axis` 上 `input_indices` 索引对应的元素组成的切片。
  5. 下图展示了Gather常用的计算过程:
  6. .. image:: Gather.png
  7. 其中,params代表输入 `input_params` ,indices代表要切片的索引 `input_indices` 。
  8. .. note::
  9. 1.input_indices的值必须在 `[0, input_param.shape[axis])` 范围内,超出该范围结果未定义。
  10. 2.Ascend平台上,input_params的数据类型当前不能是 `bool_ <https://www.mindspore.cn/docs/api/zh-CN/master/api_python/mindspore.html#mindspore.dtype>`_ 。
  11. **输入:**
  12. - **input_params** (Tensor) - 原始Tensor,shape为 :math:`(x_1, x_2, ..., x_R)` 。
  13. - **input_indices** (Tensor) - 要切片的索引Tensor,shape为 :math:`(y_1, y_2, ..., y_S)` 。指定原始Tensor中要切片的索引。数据类型必须是int32或int64。
  14. - **axis** (int) - 指定要切片的维度索引。
  15. **输出:**
  16. Tensor,shape为 :math:`input\_params.shape[:axis] + input\_indices.shape + input\_params.shape[axis + 1:]` 。
  17. **异常:**
  18. - **TypeError** - `axis` 不是int。
  19. - **TypeError** - `input_params` 不是Tensor。
  20. - **TypeError** - `input_indices` 不是int类型的Tensor。