Skip to content

[backend_cpu] Unit test `test_scheduler.py` failing on dev branch

Required prerequisites

Installed aidge_core and aidge_backend_cpu

What commit version of aidge do you use

Problem description

In the test_scheduler.py test the test_relu_forward test fails:

> (cd aidge_backend_cpu/unit_tests/ && python test_scheduler.py)
.
Assertion failed: inputIdx < nbInputs() in .../aidge/aidge/aidge_core/origindev/src/operator/OperatorTensor.cpp:72
Producer Operator has 0 inputs
======================================================================
ERROR: test_relu_forward (__main__.test_scheduler)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/cguillon/work/aidge/aidge/aidge_backend_cpu/origindev/aidge_backend_cpu/unit_tests/test_scheduler.py", line 32, in test_relu_forward
    scheduler.forward()
RuntimeError: Producer Operator has 0 inputs

Actually, this is expected as the sequence in the test (https://gitlab.eclipse.org/eclipse/aidge/aidge_backend_cpu/-/blob/f9d74d9f8accbf3e6ef4ca4341bdab25f2b71c75/aidge_backend_cpu/unit_tests/test_scheduler.py#L21):

        gv = aidge_core.GraphView()
        gv.add(relu)
        gv.add(input_node)

        input_node.add_child(relu)

Is actually an undefined behavior, indeed one has to add node connections before adding nodes. Though I'm surprised because I did not see this test fail before, hence I do not know from when it started to regress. The test itself has not been modified since long.

What happens is that ordered inputs and outputs are not correctly updated, hence somewhere in the scheduler forward or the graph view forwardDims the graph walk is confused.

Edited by Christophe Guillon