How to delete or modify node in torch._C.Graph

Hi, I’m working on a NEAT Research project, which need to manually build quite chaotic computational graphs (the operation include add delete and modify), run it and calculate the gradient. The torch._C.Graph and torch._C.GraphExecutor seen to be a good struct to expression our computational graph and run it. But there are still some questions that confusing me.

  1. if we call excutor = torch._C.GraphExecutor(graph, optimize=True), and then modify graph, does excutor(*inputs) will recompiled and get the expect output of the modified graph, or more better, partly recompiled?

  2. I found the way to add the node to the graph, but How to delete and modify node? whatever ways in python or C++.

2 Likes