just keep nodes like node in the left, don’t take backward nodes to make graph smaller, so, how to plot dot graph of rnn network without backwark nodes?
The graph that you plot only contains backward nodes. Just some explicitly contain “backward” in their name but not all.
The Function that were used during the forward pass are not saved (because they are not needed for the backward pass) so only their corresponding backwards are saved.
ok, i got your point, thanks! so if i want to draw the graph according to the forward, is there any method in recursion? i can’t find any iterator in model before given datas like ‘next_functions’ in grad_fn.
The thing is that in pytorch, there is no graph defined before hand, so the “forward graph” actually never exists as it’s just your python code when it runs that implicitly creates it.