latest (dev)
Copy
Latest development documentation · Updated 2026-10-15
tensorplay.functional.as_strided_scatter
- tensorplay.functional.as_strided_scatter(input, src, size, stride, storage_offset=None) Tensor[source]
Embeds the values of the
srctensor intoinputalong the elements corresponding to the result of calling input.as_strided(size, stride, storage_offset).This function returns a tensor with fresh storage; it does not return a view.
- Parameters:
Note
srcmust be of the proper size in order to be embedded intoinput. Specifically, it should have the same shape as tensorplay.as_strided(input, size, stride, storage_offset)Example:
>>> a = tensorplay.arange(4).reshape(2, 2) + 1 >>> a tensor([[1, 2], [3, 4]]) >>> b = tensorplay.zeros(3, 3) >>> b tensor([[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]]) >>> tensorplay.as_strided_scatter(b, a, (2, 2), (1, 2)) tensor([[1., 3., 2.], [4., 0., 0.], [0., 0., 0.]])
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?

