mindspore.ops.gather_d
- mindspore.ops.gather_d(x, dim, index)[source]
Gathers elements along an axis specified by dim.
Refer to
mindspore.ops.gather_elements()
for more detail.- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> x = mindspore.tensor([[1, 2], [3, 4]], mindspore.int32) >>> index = mindspore.tensor([[0, 0], [1, 0]], mindspore.int32) >>> dim = 1 >>> output = mindspore.ops.gather_d(x, dim, index) >>> print(output) [[1 1] [4 3]]