mOutputNode confusing definition causes issue in Scheduler
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and discussions to verify that this hasn't already been reported. +1 or comment there if it has.
What commit version of aidge do you use
-
aidge_core
: 0.3.0dev
Problem description
GraphView::mOutputNodes
attribute used to be any Node within the graph that has no chidren at all or in the graph for at least one output.
This definition has been updated and users can manually add the output node they want. By cancelling the automatic definition of output nodes, the list is not automaticcally updated if two Nodes are connected to each other and are not an output for the graph any more. If Nodes are linked after they have been alread added to the graph, their newly formed connection will not affect the mOutputNode
attribute.
Because of this, the provided list of output nodes cannot be trusted. It can be the source of errors like here !203 (diffs) in the Scheduler where a Producer
can make its way to the consumer
list which later throws an error during the forward()
call.
Reproducible example code
You just need to link the nodes after adding them.
import aidge_core as ai
relu_node_0 = ai.ReLU(name="ReLU#1")
relu_node_1 = ai.ReLU(name="ReLU#2")
g = ai.GraphView()
g.add(relu_node_0)
g.add(relu_node_1)
print(g.get_ordered_outputs())
# [
# (Node(name='ReLU#1'),
# (Node(name='ReLU#2')
# ]
relu_node_0.add_child(relu_node_1)
print(g.get_ordered_outputs())
# [
# (Node(name='ReLU#1'), should not be an output node anymore...
# (Node(name='ReLU#2')
# ]