After the bump from torch 1.11.0 to 2.0.1 it seems the graph returned from model_to_graph is not subscriptable or have the functions to get a node attribute changed?!
from torch.onnx.utils import _model_to_graph
graph, params_dict, torch_out = _model_to_graph(
model=model,
args=args,
do_constant_folding=False,
training=TrainingMode.EVAL,
operator_export_type=operator_export_type,
dynamic_axes={},
)
After this if I perform operations on the graph via node like:
foo(node[att_name]) for att_name in node.attributeNames()
I get error stating ‘torch._C.Node’ object is not subscriptable
Is this related to _model_to_graph or definition of torch.Node has changed