keras-team/keras · error · ValueError

`searchsorted` only supports 1-D sorted sequences. You can u

Error message

`searchsorted` only supports 1-D sorted sequences. You can use `keras.ops.vectorized_map` to extend it to N-D sequences. Received: sorted_sequence.shape={sorted_sequence.shape}

What it means

Error "`searchsorted` only supports 1-D sorted sequences. You can use `keras.ops.vectorized_map` to extend it to N-D sequences. Received: sorted_sequence.shape={sorted_sequence.shape}" thrown in keras-team/keras.

Source

Thrown at keras/src/backend/jax/numpy.py:1292

        # Resolve the -1 in `new_shape` if applicable and possible
        output_shape = operation_utils.compute_reshape_output_shape(
            x.shape, newshape, "new_shape"
        )
        if None not in output_shape:
            newshape = output_shape
        return jax_sparse.bcoo_reshape(x, new_sizes=newshape)
    x = convert_to_tensor(x)
    return jnp.reshape(x, newshape)


def roll(x, shift, axis=None):
    return jnp.roll(x, shift, axis=axis)


def searchsorted(sorted_sequence, values, side="left"):
    if ndim(sorted_sequence) != 1:
        raise ValueError(
            "`searchsorted` only supports 1-D sorted sequences. "
            "You can use `keras.ops.vectorized_map` "
            "to extend it to N-D sequences. Received: "
            f"sorted_sequence.shape={sorted_sequence.shape}"
        )
    return jnp.searchsorted(sorted_sequence, values, side=side)


@sparse.elementwise_unary(linear=False)
def sign(x):
    x = convert_to_tensor(x)
    return jnp.sign(x)


@sparse.elementwise_unary(linear=False)
def signbit(x):
    x = convert_to_tensor(x)
    return jnp.signbit(x)

View on GitHub (pinned to 7a34a03db6)

When it happens

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