keras-team/keras · error · ValueError

`ragged=True` is not supported with jax backend

Error message

`ragged=True` is not supported with jax backend

What it means

Error "`ragged=True` is not supported with jax backend" thrown in keras-team/keras.

Source

Thrown at keras/src/backend/jax/core.py:373

            self._var_metadata[name] = value

        object.__setattr__(self, name, value)

    NnxVariable.__setattr__ = __setattr__


def should_shard_at_init(init_layout, shape):
    size_threshold = 250 * 1024 * 1024
    # We multiply by the mesh size here to take into account the worst case
    # scenario of the array being first duplicated in the memory of one device
    # before being transferred to the other devices.
    size = math.prod(shape) * 4 * init_layout.mesh.devices.size
    return size >= size_threshold


def convert_to_tensor(x, dtype=None, sparse=None, ragged=None):
    if ragged:
        raise ValueError("`ragged=True` is not supported with jax backend")
    if dtype is not None:
        dtype = standardize_dtype(dtype)
    if isinstance(x, (jnp.ndarray, jax.Array)) and (
        dtype is None or x.dtype == dtype
    ):
        # Skip the conversion early if the instance is already a JAX array.
        # This is important in the multi-process context since jax.array(x) for
        # an existing distributed jax array will raise error.
        return x

    if isinstance(x, Variable):
        if dtype is not None and x.dtype != dtype:
            return x.value.astype(dtype)
        return x.value

    if isinstance(x, jax_sparse.JAXSparse):
        if sparse is not None and not sparse:
            x = x.todense()

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/backend/jax/core.py:373 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/c3aaa251047b7740. Report an issue: GitHub.