as_strided#

ivy.as_strided(x, shape, strides, /)[source]#

Create a copy of the input array with the given shape and strides.

Parameters:
  • x (Union[Array, NativeArray]) – Input Array.

  • shape (Union[Shape, NativeShape, Sequence[int]]) – The shape of the new array.

  • strides (Sequence[int]) – The strides of the new array (specified in bytes).

Return type:

Array

Returns:

ret – Output Array

Examples

>>> x = ivy.array([1, 2, 3, 4, 5, 6])
>>> ivy.as_strided(x, (4, 3), (8, 8))
ivy.array([[1, 2, 3],
   [2, 3, 4],
   [3, 4, 5],
   [4, 5, 6]])
Array.as_strided(self, shape, strides, /)[source]#

Create a copy of the input array with the given shape and strides.

Parameters:
  • self (Array) – Input Array.

  • shape (Union[Shape, NativeShape, Sequence[int]]) – The shape of the new array.

  • strides (Sequence[int]) – The strides of the new array (specified in bytes).

Return type:

Array

Returns:

ret – Output Array

Container.as_strided(self, shape, strides, /)[source]#

ivy.Container instance method variant of ivy.as_strided. This method simply wraps the function, and so the docstring for ivy.as_strided also applies to this method with minimal changes.

Parameters:
  • self (Union[Array, NativeArray, Container]) – Input container.

  • shape (Union[Shape, NativeShape, Sequence[int], Container]) – The shape of the new arrays.

  • strides (Union[Sequence[int], Container]) – The strides of the new arrays (specified in bytes).

Return type:

Container

Returns:

ret – Output container.