mindspore.mint.select

View Source On Gitee
mindspore.mint.select(input, dim, index)[source]

Slices the input tensor along the selected dimension at the given index.

Warning

This is an experimental API that is subject to change or deletion.

Parameters
  • input (Tensor) – the input tensor.

  • dim (int) – the dimension to slice.

  • index (int) – the index to select with.

Returns

Tensor.

Raises

TypeError – If input is not a Tensor.

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> from mindspore import Tensor, mint
>>> input = Tensor([[2, 3, 4, 5],[3, 2, 4, 5]])
>>> y = mint.select(input, 0, 0)
>>> y = Tensor([1,2], mindspore.float32)
>>> print(y)
[2 3 4 5]