jax.numpy.rot90
Contents
jax.numpy.rot90#
- jax.numpy.rot90(m,k=1,axes=(0,1))[source]#
Rotate an array by 90 degrees counterclockwise in the plane specified by axes.
JAX implementation of
numpy.rot90().- Parameters:
m (ArrayLike) – input array. Must have
m.ndim>=2.k (int) – int, optional, default=1. Specifies the number of times the array is rotated.For negative values of
k, the array is rotated in clockwise direction.axes (tuple[int,int]) – tuple of 2 integers, optional, default= (0, 1). The axes define the planein which the array is rotated. Both the axes must be different.
- Returns:
An array containing the copy of the input,
mrotated by 90 degrees.- Return type:
See also
jax.numpy.flip(): reverse the order along the given axisjax.numpy.fliplr(): reverse the order along axis 1 (left/right)jax.numpy.flipud(): reverse the order along axis 0 (up/down)
Examples
>>>m=jnp.array([[1,2,3],...[4,5,6]])>>>jnp.rot90(m)Array([[3, 6], [2, 5], [1, 4]], dtype=int32)>>>jnp.rot90(m,k=2)Array([[6, 5, 4], [3, 2, 1]], dtype=int32)
jnp.rot90(m,k=1,axes=(1,0))is equivalent tojnp.rot90(m,k=-1,axes(0,1)).>>>jnp.rot90(m,axes=(1,0))Array([[4, 1], [5, 2], [6, 3]], dtype=int32)>>>jnp.rot90(m,k=-1,axes=(0,1))Array([[4, 1], [5, 2], [6, 3]], dtype=int32)
when input array has
ndim>2:>>>m1=jnp.array([[[1,2,3],...[4,5,6]],...[[7,8,9],...[10,11,12]]])>>>jnp.rot90(m1,k=1,axes=(2,1))Array([[[ 4, 1], [ 5, 2], [ 6, 3]], [[10, 7], [11, 8], [12, 9]]], dtype=int32)
