ONNX (.onnx)
- Import partially supports Version 15 and earlier of the standard ONNX operator set.
- Export exports to Version 15 of the standard ONNX operator set.
Background & Context

-
- Open format for neural network models.
- Stores models and various metadata.
- ONNX is an acronym for Open Neural Network Exchange.
- Binary file format based on Protobuf.
- First released in 2017 by Microsoft and Facebook.
Import & Export

- Import["file.onnx"] imports the net stored in the specified file, returning it as a NetChain, NetGraph or a similar construct.
- Import["file.onnx",elem] imports the specified element elem.
- The import format can be specified with Import["file","ONNX"] or Import["file",{"ONNX",elem,…}].
- Export["file.onnx",net] exports net as an ONNX model.
- The following expressions are supported:
-
NetChain[…] a net represented as a chain of layers NetGraph[…] a net represented as a graph of layers layer any net layer such as LinearLayer, ... - See the following reference pages for full general information:
-
Import, Export import from or export to a file CloudImport, CloudExport import from or export to a cloud object ImportString, ExportString import from or export to a string ImportByteArray, ExportByteArray import from or export to a byte array
Import Elements

- General Import elements:
-
"Elements" list of elements and options available in this file "Summary" summary of the file "Rules" list of rules for all available elements - Import elements include:
-
"ArrayAssociation" parameter arrays as an association "ArrayList" parameter arrays as a list "Description" human-readable description for the model "ONNXGraph" ONNX representation of the net "ModelDomain" model namespace or domain "ModelVersion" integer version number of the model "Net" Wolfram Language representation of the net, including all initialized arrays (default) "NetExternalObject" NetExternalObject representation of the net "IRVersion" version of the ONNX intermediate representation used by the model "OperatorSetVersion" operator sets the model is compatible with "ProducerName" name of the tool used to generate the model "ProducerVersion" version of the generating tool "RawData" full, unprocessed contents of the file, including the graph representation and all metadata "UninitializedNet" Wolfram Language representation of the net, without any arrays
Options

Examples
open allclose allBasic Examples (2)
Show the Import elements available in this file:
Import Elements (14)
NetExternalObject (1)
Import the ONNX model as a NetExternalObject:
Import Options (1)
Export Options (3)
Possible Issues (1)
Any NetEncoder or NetDecoder is automatically removed by Export, as ONNX does not support them. Create a net with a NetEncoder and a NetDecoder and export it:
Importing the model back shows that no NetEncoder or NetDecoder are present: