keras-team/keras · error · ValueError

select(): condlist and choicelist must have the same length

Error message

select(): condlist and choicelist must have the same length

What it means

Raised by keras.ops.numpy.select in the OpenVINO backend when condlist and choicelist have different lengths. Each condition must be paired with a choice, so the length mismatch is rejected before building the nested select graph.

Solutions

  1. Make condlist and choicelist the same length, pairing each condition with its choice
  2. Add or remove entries so both lists match
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    else:
        raise ValueError(
            f"mode: {mode} not available chose from valid, same, full."
        )

    axes = ov_opset.constant([0, 1], dtype=Type.i64).output(0)
    x2 = ov_opset.unsqueeze(x2, axes).output(0)
    x1 = ov_opset.unsqueeze(x1, axes).output(0)

    result = ov_opset.convolution(x1, x2, [1], [0], [0], [1]).output(0)

    result = ov_opset.squeeze(result, axes).output(0)

    return OpenVINOKerasTensor(result)


def select(condlist, choicelist, default=0):
    if len(condlist) != len(choicelist):
        raise ValueError(
            "select(): condlist and choicelist must have the same length"
        )
    conds = [get_ov_output(c) for c in condlist]
    choices = [get_ov_output(v) for v in choicelist]

    result = get_ov_output(default)
    for cond_idx in reversed(range(len(conds))):
        cond = conds[cond_idx]
        choice = choices[cond_idx]
        choice, result = _align_operand_types(choice, result, "select()")
        result = ov_opset.select(cond, choice, result).output(0)
    return OpenVINOKerasTensor(result)


def slogdet(x):
    x = convert_to_tensor(x)
    x_ov = get_ov_output(x)
    x_ov_type = x_ov.get_element_type()

View on GitHub (pinned to 7a34a03db6)