mindspore.ops.intopk
- mindspore.ops.intopk(x1, x2, k)[source]
Return whether the elements in second input tensor exist among the top k elements of the first input tensor.
- Parameters
- Returns
A 1-D tensor whose data type is bool, has the same shape with x2.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> x1 = mindspore.tensor([[1, 8, 5, 2, 7], [4, 9, 1, 3, 5]], mindspore.float32) >>> x2 = mindspore.tensor([1, 3], mindspore.int32) >>> mindspore.ops.intopk(x1, x2, 3) Tensor(shape=[2], dtype=Bool, value= [ True, False])