tf.keras.ops.rot90
Stay organized with collections
Save and categorize content based on your preferences.
Rotate an array by 90 degrees in the plane specified by axes.
tf.keras.ops.rot90(
array, k=1, axes=(0, 1)
)
This function rotates an array counterclockwise
by 90 degrees k times in the plane specified by axes.
Supports arrays of two or more dimensions.
Args |
array
|
Input array to rotate.
|
k
|
Number of times the array is rotated by 90 degrees.
|
axes
|
A tuple of two integers specifying the
plane of rotation (defaults to (0, 1)).
|
Examples:
import numpy as np
from keras import ops
m = np.array([[1, 2], [3, 4]])
rotated = ops.rot90(m)
rotated
array([[2, 4],
[1, 3]])
m = np.arange(8).reshape((2, 2, 2))
rotated = ops.rot90(m, k=1, axes=(1, 2))
rotated
array([[[1, 3],
[0, 2]],
[[5, 7],
[4, 6]]])
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2026-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-10-31 UTC."],[],[]]