mindspore.ops.select_scatter

View Source On Gitee
mindspore.ops.select_scatter(input, src, axis, index)[source]

On the specified dimension axis of input , src is scattered into input on the specified index of input .

Parameters
  • input (Tensor) – The input tensor.

  • src (Tensor) – The source tensor.

  • axis (int) – The dimension of input to be embedded.

  • index (int) – The location of scattering on the specified dimension.

Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> input = mindspore.ops.zeros((2, 3, 3))
>>> src = mindspore.ops.ones((2, 3))
>>> output = mindspore.ops.select_scatter(input, src, axis=1, index=1)
>>> print(output)
[[[0. 0. 0.]
  [1. 1. 1.]
  [0. 0. 0.]]
 [[0. 0. 0.]
  [1. 1. 1.]
  [0. 0. 0.]]]