Skip to content

[core] Get_node in graph view after set_name does not work

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.2.0 dev branch

Problem description

After renaming a node in a GraphView, using get_node with the new name does not work, it still works with the old node name.

import aidge_core

graph_view = aidge_core.sequential([
    aidge_core.FC(1, 50, name='layer_1'),
    aidge_core.ReLU("relu"),
    aidge_core.FC(50, 50, name='layer_2'),
])

relu_node = graph_view.get_node("relu") # that works
print(relu_node.name()) 
relu_node.set_name("new_name")

# that prints "new_name" for the relu node
print([node.name() for node in graph_view.get_nodes()]) => ['layer_1_b', 'new_name', 'layer_1', 'layer_2', 'layer_1_w', 'layer_2_w', 'layer_2_b']

graph_view.get_node("new_name") # that fails => No Node named new_name in the current GraphView .
graph_view.get_node("relu") # that works