mindspore.ops.slice_scatter

View Source On Gitee
mindspore.ops.slice_scatter(input, src, axis=0, start=None, end=None, step=1)[source]

Embed src into the sliced input along the specified axis .

Parameters
  • input (Tensor) – The input tensor.

  • src (Tensor) – The source tensor to be embedded into input .

  • axis (int, optional) – The axis of input to be sliced. Default 0 .

  • start (int, optional) – The start index for embedding in the specified axis. Default None , which means start is 0 .

  • end (int, optional) – The end index for embedding in the specified axis. Default None , which means end is the length of input in the specified axis.

  • step (int, optional) – The step size to skip during embedding. Default 1 .

Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> a = mindspore.ops.zeros((4, 6))
>>> b = mindspore.ops.ones((4, 3))
>>> output = mindspore.ops.slice_scatter(input=a, src=b, axis=1, start=0, end=5, step=2)
>>> print(output)
[[1. 0. 1. 0. 1. 0.]
 [1. 0. 1. 0. 1. 0.]
 [1. 0. 1. 0. 1. 0.]
 [1. 0. 1. 0. 1. 0.]]