mindspore.ops.select_scatter

查看源文件
mindspore.ops.select_scatter(input, src, axis, index)[源代码]

src 中的值散布到 input 指定轴 axis 的指定位置 index 上。

参数:
  • input (Tensor) - 输入tensor。

  • src (Tensor) - 源tensor。

  • axis (int) - 指定轴。

  • index (int) - 在指定轴上散布的位置。

返回:

Tensor

支持平台:

Ascend GPU CPU

样例:

>>> 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.]]]