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/jax/numpy.py:40

        device = x.device
        if not isinstance(device, jax.Device):
            # Array is sharded.
            return False
        return device.platform == "cpu"
    else:
        # This is a Tracer, not a concrete Array.
        return jax.default_backend() == "cpu"


def rot90(array, k=1, axes=(0, 1)):
    """Rotate an array by 90 degrees in the specified plane."""
    if array.ndim < 2:
        raise ValueError(
            f"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 jnp.rot90(array, k=k, axes=axes)


@sparse.elementwise_binary_union(linear=True, use_sparsify=True)
def add(x1, x2):
    x1 = convert_to_tensor(x1)
    x2 = convert_to_tensor(x2)
    return jnp.add(x1, x2)


def bartlett(x):
    x = convert_to_tensor(x)
    return cast(jnp.bartlett(x), config.floatx())

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/backend/jax/numpy.py:40 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/a5d367e95420e4ca. Report an issue: GitHub.