Rotate an array by 90 degrees counterclockwise in the plane specified by axes.
JAX implementation of numpy.rot90()
.
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 plane in which the array is rotated. Both the axes must be different.
An array containing the copy of the input, m
rotated by 90 degrees.
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 to jnp.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)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3