File Formats
  • Audio
  • Video
  • Images
  • 3D & CAD
  • Documents
  • Data
  • Code
  • System
Data
  • Structured text
  • Binary serialisation
  • Databases
  • Scientific
  • Geospatial
  • Machine learning
  • Messages & calendars
  • Compression
  • Archives
  1. Home
  2. Data
  3. Machine learning
  4. ONNX
.ONNX
  • Overview

.ONNX

Open Neural Network Exchange

Introduction

ONNX is an open format for trained neural networks, started by Facebook and Microsoft in 2017. An ONNX file holds the whole network, both its graph of operations and its weights, so a model trained in one framework can run in another program or on another device. It is widely used to move models from PyTorch into ONNX Runtime and onto phones and embedded hardware.

Software

  • ONNX Runtime (Windows, macOS, Linux, Android, iOS, web)
  • Netron, a viewer that draws the network (Windows, macOS, Linux, web)
  • The onnx Python package, for checking and editing models
  • PyTorch, which exports models to ONNX

Structure

An ONNX file is a single Protocol Buffers message of type ModelProto, defined in the project’s onnx.proto schema. It has no magic number of its own. Its main fields are:

  • ir_version: the version of the ONNX format
  • opset_import: the operator sets the model uses, with their versions
  • producer_name and producer_version: the program that wrote it
  • graph: the network itself, with its nodes (each an operator such as Conv or MatMul with named inputs and outputs), its inputs and outputs, and its initializer tensors holding the weights

A Protocol Buffers message is limited to 2 GB, so large models keep their weights in separate files beside the .onnx file, which refers to them by name.

© 2026 fileformats.org About Contact Made by Lewpen