12.1 ONNX
ONNX : Open Neural Network Exchange
Created Date: 2025-06-26
ONNX is an open format built to represent machine learning models. ONNX defines a common set of operators - the building blocks of machine learning and deep learning models - and a common file format to enable AI developers to use models with a variety of frameworks, tools, runtimes, and compilers.
12.1.1 Build Model
Building an ONNX model primarily involves defining a computational graph using ONNX operators and then serializing it into the ONNX format. While you typically train a model in a framework like PyTorch or TensorFlow and then export it to ONNX, you can also construct an ONNX graph directly using the onnx Python library.
12.1.1.1 Construct Directly
Here's how you can conceptualize building an ONNX model:
-
Define the Computational Graph: