@ptrblck I’m not sure that recreate a graph replica will help in that case, since that I still don’t know how to create a prim::Constant with the attribute value="cuda:0".
my mistake was that there is no prim::Constant[value="cuda:0"] node kind, I need to create the node by:
cuda_node = graph.create('prim::Constant')

and then I need to set for cuda_node an attribute value="cuda:0" but I’m not sure how.