Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K
JAX  documentation - Home

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 ofnumpy.rot90().

Parameters:
  • m (ArrayLike) – input array. Must havem.ndim>=2.

  • k (int) – int, optional, default=1. Specifies the number of times the array is rotated.For negative values ofk, 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,m rotated by 90 degrees.

Return type:

Array

See also

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 hasndim>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)
Contents

[8]ページ先頭

©2009-2025 Movatter.jp