keras-team/keras · error · ValueError

Cannot determine `ndim`: tensor has a dynamically-ranked Par

Error message

Cannot determine `ndim`: tensor has a dynamically-ranked PartialShape. The OpenVINO backend requires a statically-known rank for this operation.

What it means

Error "Cannot determine `ndim`: tensor has a dynamically-ranked PartialShape. The OpenVINO backend requires a statically-known rank for this operation." thrown in keras-team/keras.

Source

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

    ).output(0)
    neginf_mask = ov_opset.is_inf(
        x,
        {"detect_positive": False, "detect_negative": True},
    ).output(0)
    nan_mask = ov_opset.is_nan(x).output(0)
    x = ov_opset.select(nan_mask, nan_val, x).output(0)
    x = ov_opset.select(posinf_mask, posinf_val, x).output(0)
    x = ov_opset.select(neginf_mask, neginf_val, x).output(0)
    if isfloat64:
        x = ov_opset.convert(x, Type.f64).output(0)
    return OpenVINOKerasTensor(x)


def ndim(x):
    x = get_ov_output(x)
    rank = x.get_partial_shape().rank
    if not rank.is_static:
        raise ValueError(
            "Cannot determine `ndim`: tensor has a dynamically-ranked "
            "PartialShape. The OpenVINO backend requires a statically-known "
            "rank for this operation."
        )
    return rank.get_length()


def nonzero(x):
    x = get_ov_output(x)
    res = ov_opset.non_zero(data=x, output_type="i32").output(0)
    return OpenVINOKerasTensor(res)


def not_equal(x1, x2):
    element_type = None
    if isinstance(x1, OpenVINOKerasTensor):
        element_type = x1.output.get_element_type()
    if isinstance(x2, OpenVINOKerasTensor):

View on GitHub (pinned to 7a34a03db6)

When it happens

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