keras-team/keras · error · ValueError

mode: not available chose from valid, same, full.

Error message

mode: {mode} not available chose from valid, same, full.

What it means

Raised by keras.ops.numpy.convolve in the OpenVINO backend when the mode argument is not 'valid', 'same', or 'full'. These three modes determine how the sequences are padded before the convolution; anything else falls through to the catch-all guard.

Solutions

  1. Use mode='valid', 'same', or 'full'
  2. Omit mode to use the default ('valid')
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    elif mode == "same":
        shape_minus_one_float = ov_opset.convert(
            shape_filter_minus_one, Type.f64
        ).output(0)

        right = ov_opset.divide(shape_minus_one_float, const_two).output(0)
        left = ov_opset.ceil(right).output(0)
        right = ov_opset.floor(right).output(0)
        left = ov_opset.convert(left, Type.i64).output(0)
        right = ov_opset.convert(right, Type.i64).output(0)
        x1 = ov_opset.pad(x1, left, right, "constant", const_zero).output(0)

    elif mode == "full":
        pad = shape_filter_minus_one
        x1 = ov_opset.pad(x1, pad, pad, "constant", const_zero).output(0)

    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"

View on GitHub (pinned to 7a34a03db6)