flipud#

ivy.flipud(m, /, *, copy=None, out=None)[source]#

Flip array in the up/down direction. Flip the entries in each column in the up/down direction. Rows are preserved, but appear in a different order than before.

Parameters:
  • m (Union[Array, NativeArray]) – The array to be flipped.

  • out (Optional[Union[Array, NativeArray]]) – optional output array, for writing the result to. (default: None)

Return type:

Union[Array, NativeArray]

Returns:

ret – Array corresponding to input array with elements order reversed along axis 0.

Examples

>>> m = ivy.diag([1, 2, 3])
>>> ivy.flipud(m)
ivy.array([[ 0.,  0.,  3.],
    [ 0.,  2.,  0.],
    [ 1.,  0.,  0.]])
Array.flipud(self, /, *, copy=None, out=None)#

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

Parameters:
  • self (Array) – The array to be flipped.

  • out (Optional[Array]) – optional output array, for writing the result to. (default: None)

Return type:

Array

Returns:

ret – Array corresponding to input array with elements order reversed along axis 0.

Examples

>>> m = ivy.diag([1, 2, 3])
>>> m.flipud()
ivy.array([[ 0.,  0.,  3.],
    [ 0.,  2.,  0.],
    [ 1.,  0.,  0.]])
Container.flipud(self, /, *, copy=None, out=None)#

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

Parameters:
  • self (Container) – the container with arrays to be flipped.

  • out (Optional[Container]) – optional output container, for writing the result to. (default: None)

Return type:

Container

Returns:

ret – container including arrays corresponding to the input container’s array with elements order reversed along axis 0.

Examples

With one ivy.Container input:

>>> m = ivy.Container(a=ivy.diag([1, 2, 3]), b=ivy.arange(4))
>>> m.flipud()
{
    a: ivy.array(
        [[ 0.,  0.,  3.],
         [ 0.,  2.,  0.],
         [ 1.,  0.,  0.]]
    )
    b: ivy.array([3, 2, 1, 0])
}