package caisar

  1. Overview
  2. Docs

Module Onnx_protoc.Onnx

module Version : sig ... end

Versioning

ONNX versioning is specified in docs/IR.md and elaborated on in docs/Versioning.md

To be compatible with both proto2 and proto3, we will use a version number that is not defined by the default value but an explicit enum number.

Overview

ONNX is an open specification that is comprised of the following components:

  1. A definition of an extensible computation graph model.
  2. Definitions of standard data types.
  3. Definitions of built-in operators.

This document describes the syntax of models and their computation graphs, as well as the standard data types. Together, they are referred to as the ONNX Intermediate Representation, or 'IR' for short.

The normative semantic specification of the ONNX IR is found in docs/IR.md. Definitions of the built-in neural network operators may be found in docs/Operators.md.

Notes

Protobuf compatibility

To simplify framework compatibility, ONNX is defined using the subset of protobuf that is compatible with both protobuf v2 and v3. This means that we do not use any protobuf features that are only available in one of the two versions.

Here are the most notable contortions we have to carry out to work around these limitations:

  • No 'map' (added protobuf 3.0). We instead represent mappings as lists of key-value pairs, where order does not matter and duplicates are not allowed.
module OperatorStatus : sig ... end

Operator/function status.

module AttributeProto : sig ... end

Attributes

A named attribute containing either singular float, integer, string, graph, and tensor values, or repeated float, integer, string, graph, and tensor values. An AttributeProto MUST contain the name field, and only one of the following content fields, effectively enforcing a C/C++ union equivalent.

module ValueInfoProto : sig ... end

Defines information on value, including the name, the type, and the shape of the value.

module NodeProto : sig ... end

Nodes

Computation graphs are made up of a DAG of nodes, which represent what is commonly called a "layer" or "pipeline stage" in machine learning frameworks.

For example, it can be a node of type "Conv" that takes in an image, a filter tensor and a bias tensor, and produces the convolved output.

module TrainingInfoProto : sig ... end

Training information TrainingInfoProto stores information for training a model. In particular, this defines two functionalities: an initialization-step and a training-algorithm-step. Initialization resets the model back to its original state as if no training has been performed. Training algorithm improves the model based on input data.

The semantics of the initialization-step is that the initializers in ModelProto.graph and in TrainingInfoProto.algorithm are first initialized as specified by the initializers in the graph, and then updated by the "initialization_binding" in every instance in ModelProto.training_info.

The field "algorithm" defines a computation graph which represents a training algorithm's step. After the execution of a TrainingInfoProto.algorithm, the initializers specified by "update_binding" may be immediately updated. If the targeted training algorithm contains consecutive update steps (such as block coordinate descent methods), the user needs to create a TrainingInfoProto for each step.

module ModelProto : sig ... end

Models

ModelProto is a top-level file/container format for bundling a ML model and associating its computation graph with metadata.

The semantics of the model are described by the associated GraphProto's.

module StringStringEntryProto : sig ... end

StringStringEntryProto follows the pattern for cross-proto-version maps. See https://developers.google.com/protocol-buffers/docs/proto3#maps

module TensorAnnotation : sig ... end
module GraphProto : sig ... end

Graphs

A graph defines the computational logic of a model and is comprised of a parameterized list of nodes that form a directed acyclic graph based on their inputs and outputs. This is the equivalent of the "network" or "graph" in many deep learning frameworks.

module TensorProto : sig ... end

Tensors

A serialized tensor value.

module SparseTensorProto : sig ... end

A serialized sparse-tensor value

module TensorShapeProto : sig ... end

Defines a tensor shape. A dimension can be either an integer value or a symbolic variable. A symbolic variable represents an unknown dimension.

module TypeProto : sig ... end

Types

The standard ONNX data types.

module OperatorSetIdProto : sig ... end

Operator Sets

OperatorSets are uniquely identified by a (domain, opset_version) pair.

module FunctionProto : sig ... end