Renaming the input and output nodes


I have built a basic image classifier using the “Training the Classifier” tutorial in the 60 minute Blitz section. After building the model, I have exported it into ONNX format. When I read this ONNX graph using Netron on windows, I can see that the input Node is named as 0 and the output node is named as 23 which are mere numbers.

I wish to renames these input and output nodes. Could anyone please help me with this? Which part of the tutorial code should I be making a change?

Krishna Chaitanya Bandi

I guess you exported your model using torch.onnx.export.
If so, you can specify the input_names and output_names as arguments.
The first code sample in this example shows the usage.

1 Like