Skip to content

[OpenVINO backend] test_logsumexp fails #21470

Open
@Mohamed-Ashraf273

Description

@Mohamed-Ashraf273

In this function:
https://github.com/keras-team/keras/blob/master/keras/src/backend/openvino/math.py#L30-L48

Running the math test with openvino backend:

pytest -c pytest.ini keras/src/ops/math_test.py -v

Gives:

=================================== FAILURES ===================================
____________________ MathOpsCorrectnessTest.test_logsumexp _____________________

self = <keras.src.ops.math_test.MathOpsCorrectnessTest testMethod=test_logsumexp>

    def test_logsumexp(self):
        x = np.random.rand(5, 5)
        outputs = kmath.logsumexp(x)
        expected = np.log(np.sum(np.exp(x)))
        self.assertAllClose(outputs, expected)
    
        outputs = kmath.logsumexp(x, axis=1)
        expected = np.log(np.sum(np.exp(x), axis=1))
>       self.assertAllClose(outputs, expected)

keras/src/ops/math_test.py:680: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
keras/src/testing/test_case.py:48: in assertAllClose
    np.testing.assert_allclose(x1, x2, atol=atol, rtol=rtol, err_msg=msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<function assert_allclose.<locals>.compare at 0x7572ef871080>, array([2.32454872, 2.03384614, 2.43761063, 1.91885555, 2.03327584]), array([2.23744892, 2.11629929, 2.30870708, 1.99097716, 2.06320653]))
kwds = {'equal_nan': True, 'err_msg': 'None', 'header': 'Not equal to tolerance rtol=1e-06, atol=1e-06', 'strict': False, ...}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
                   ^^^^^^^^^^^^^^^^^^^
E           AssertionError: 
E           Not equal to tolerance rtol=1e-06, atol=1e-06
E           None
E           Mismatched elements: 5 / 5 (100%)
E           Max absolute difference among violations: 0.12890355
E           Max relative difference among violations: 0.05583365
E            ACTUAL: array([2.324549, 2.033846, 2.437611, 1.918856, 2.033276])
E            DESIRED: array([2.237449, 2.116299, 2.308707, 1.990977, 2.063207])

/usr/lib/python3.12/contextlib.py:81: AssertionError
=============================== warnings summary ===============================
../../../../../usr/lib/python3.12/multiprocessing/popen_fork.py:66
../../../../../usr/lib/python3.12/multiprocessing/popen_fork.py:66
  /usr/lib/python3.12/multiprocessing/popen_fork.py:66: DeprecationWarning: This process (pid=10201) is multi-threaded, use of fork() may lead to deadlocks in the child.
    self.pid = os.fork()

../env/lib/python3.12/site-packages/openvino/runtime/__init__.py:10
  /home/mohamed-ashraf/Desktop/GSoC2025/env/lib/python3.12/site-packages/openvino/runtime/__init__.py:10: DeprecationWarning: The `openvino.runtime` module is deprecated and will be removed in the 2026.0 release. Please replace `openvino.runtime` with `openvino`.
    warnings.warn(

../env/lib/python3.12/site-packages/_pytest/config/__init__.py:1474
  /home/mohamed-ashraf/Desktop/GSoC2025/env/lib/python3.12/site-packages/_pytest/config/__init__.py:1474: PytestConfigWarning: Unknown config option: env
  
    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED keras/src/ops/math_test.py::MathOpsCorrectnessTest::test_logsumexp - A...
============= 1 failed, 74 passed, 59 skipped, 4 warnings in 0.69s =============

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions