How to view the weights of the ONNX model structure?

To view the structure and weights of an ONNX model, you can use the tools provided by the ONNX framework or choose a third-party tool. Here are two commonly used methods:

  1. Utilize the command line tools provided by ONNX official website, such as onnxruntime and onnxsimulator, to inspect the structure and weights of ONNX models. Simply run the appropriate commands in the command line. For instance, using onnxsimulator, you can run the following command to view the model’s structure and weights:
onnxsimulator --input_model=model.onnx
  1. Third-party ONNX visualization tools such as Netron and TensorBoard can assist in examining the structure and weights of an ONNX model. These tools typically offer a visual interface to easily visualize the model’s structure and weights. Simply import the ONNX model file into one of these tools to view it.

Note: ONNX models are usually saved in binary form and can be viewed for their structure and weights using the above tools, but the specific numerical values of the model cannot be directly viewed. To view the specific numerical values of the model, you can load the ONNX model using the corresponding framework (such as PyTorch, TensorFlow, etc.) and view the values of the model parameters.

bannerAds