keras-team/keras · error · ValueError

`lcm` is only supported for integer types.

Error message

`lcm` is only supported for integer types.

What it means

Error "`lcm` is only supported for integer types." thrown in keras-team/keras.

Source

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

        flatten,
        False,
    )
    result = ov_opset.multiply(
        ov_opset.reshape(x1, x1_new_shape, False),
        ov_opset.reshape(x2, x2_new_shape, False),
    )
    result = ov_opset.reshape(
        result, ov_opset.multiply(shape1, shape2), False
    ).output(0)
    return OpenVINOKerasTensor(result)


def lcm(x1, x2):
    x1 = get_ov_output(x1)
    x2 = get_ov_output(x2)
    x1, x2 = _align_operand_types(x1, x2, "lcm()")
    if not x1.get_element_type().is_integral():
        raise ValueError("`lcm` is only supported for integer types.")
    x1_abs = ov_opset.abs(x1).output(0)
    x2_abs = ov_opset.abs(x2).output(0)

    gcd_val = gcd(x1, x2)
    gcd_val = get_ov_output(gcd_val)

    zero = ov_opset.constant(0, gcd_val.get_element_type()).output(0)
    one = ov_opset.constant(1, gcd_val.get_element_type()).output(0)

    is_zero = ov_opset.equal(gcd_val, zero).output(0)
    safe_gcd = ov_opset.select(is_zero, one, gcd_val).output(0)

    term1 = ov_opset.divide(x1_abs, safe_gcd).output(0)
    result = ov_opset.multiply(term1, x2_abs).output(0)

    return OpenVINOKerasTensor(result)

View on GitHub (pinned to 7a34a03db6)

When it happens

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