Today, I use get_graph_node_names
to get the trian nodes and test nodes.
such as : train_nodes, test_nodes = get_graph_node_names(module)
But while I’m running it
There a error about this :
torch.fx.proxy.TraceError:symbolically traced variables cannot be used as inputs to control flow
.
I know. This problem with the model,but the model can be normally forward
I can’t find other problem from this model.
please, help me, how to deal it.
the code follow as :
from torch.fx import Tracer
import torch.nn as nn
import torch
lstm = nn.LSTM(300, 100, 1)
x = torch.randn(7, 64, 300)
h = torch.randn(1, 64, 100)
c = torch.randn(1, 64, 100)
lstm(x, (h, c))
nodes = Tracer().trace(lstm).nodes