keras-team/keras · error · ValueError
Invalid axes: {axes}. Axes must be a tuple of two different
Error message
Invalid axes: {axes}. Axes must be a tuple of two different dimensions. What it means
Error "Invalid axes: {axes}. Axes must be a tuple of two different dimensions." thrown in keras-team/keras.
Source
Thrown at keras/src/backend/numpy/ops/numpy.py:21
from keras.src import backend
from keras.src import tree
from keras.src.backend import config
from keras.src.backend.common import dtypes
from keras.src.backend.common.backend_utils import canonicalize_axis
from keras.src.backend.common.backend_utils import standardize_axis_for_numpy
from keras.src.backend.common.variables import standardize_dtype
from keras.src.backend.numpy.ops.core import convert_to_tensor
def rot90(array, k=1, axes=(0, 1)):
"""Rotate an array by 90 degrees in the specified plane."""
if array.ndim < 2:
raise ValueError(
"Input array must have at least 2 dimensions. "
f"Received: array.ndim={array.ndim}"
)
if len(axes) != 2 or axes[0] == axes[1]:
raise ValueError(
f"Invalid axes: {axes}. Axes must be a tuple "
"of two different dimensions."
)
return np.rot90(array, k=k, axes=axes)
def add(x1, x2):
if not isinstance(x1, (int, float)):
x1 = convert_to_tensor(x1)
if not isinstance(x2, (int, float)):
x2 = convert_to_tensor(x2)
dtype = dtypes.result_type(
getattr(x1, "dtype", type(x1)),
getattr(x2, "dtype", type(x2)),
)
x1 = convert_to_tensor(x1, dtype)
x2 = convert_to_tensor(x2, dtype)
return np.add(x1, x2)View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/backend/numpy/ops/numpy.py:21 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25).
Data as JSON: /api/errors/abfe1a5387e636d4.
Report an issue: GitHub.