mindspore.ops.gather_nd ======================= .. image:: https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/br_base/resource/_static/logo_source.svg :target: https://gitee.com/mindspore/mindspore/blob/br_base/docs/api/api_python/ops/mindspore.ops.func_gather_nd.rst :alt: 查看源文件 .. py:function:: mindspore.ops.gather_nd(input_x, indices) 根据指定索引获取输入tensor的切片。 假设 `indices` 是一个K维的整型张量,遵循公式如下: .. math:: output[(i_0, ..., i_{K-2})] = input\_x[indices[(i_0, ..., i_{K-2})]] 需满足 :math:`indices.shape[-1] <= len(input\_x.shape)` 。 参数: - **input_x** (Tensor) - 输入tensor。 - **indices** (Tensor) - 指定索引。 返回: Tensor