keras-team/keras · error · ValueError

`side` must be either 'left' or 'right'. Received: side=

Error message

`side` must be either 'left' or 'right'. Received: side={side}

What it means

Raised by keras.ops.numpy.searchsorted in the OpenVINO backend when the side argument is not 'left' or 'right'. These two values select which index to return for values equal to a bin edge; other strings are rejected by the guard.

Solutions

  1. Pass side='left' or side='right'
  2. Omit side to use the default 'left'
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at keras/src/backend/openvino/numpy.py:4201 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/1787eee7d218defd. Report an issue: GitHub.

Appendix: source

Thrown at keras/src/backend/openvino/numpy.py:4201

    x = get_ov_output(x)
    if axis is not None:
        # The Roll operation requires `shift` and `axis` to have the same
        # length, while numpy broadcasts them against each other.
        shifts, axes = normalize_shift_and_axis(shift, axis)
        result = ov_opset.roll(x, shifts, axes).output(0)
    else:
        output_shape = ov_opset.shape_of(x).output(0)
        flattened = ov_opset.reshape(
            x, ov_opset.constant([-1], Type.i32), False
        ).output(0)
        result = ov_opset.roll(flattened, shift, 0).output(0)
        result = ov_opset.reshape(result, output_shape, False).output(0)
    return OpenVINOKerasTensor(result)


def searchsorted(sorted_sequence, values, side="left"):
    if side not in ("left", "right"):
        raise ValueError(
            f"`side` must be either 'left' or 'right'. Received: side={side}"
        )
    sorted_sequence = get_ov_output(sorted_sequence)
    values = get_ov_output(values)

    if sorted_sequence.get_partial_shape().rank.get_length() != 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.get_partial_shape()}"
        )

    sorted_sequence, values = _align_operand_types(
        sorted_sequence, values, "searchsorted()"
    )

    # Note: OpenVINO's bucketize with_right_bound has opposite semantics

View on GitHub (pinned to 7a34a03db6)