ONNX - Operators



Operators in ONNX are the building blocks that define computations in a machine learning model, mapping operations from various frameworks (like TensorFlow, PyTorch, etc.) into a standardized ONNX format.

In this tutorial, well explore what ONNX operators are, the different types, and how they function in ONNX-compatible models.

What are ONNX Operators?

An ONNX operator is a fundamental unit of computation used in an ONNX model. Each operator defines a specific type of operation, such as mathematical computations, data processing, or neural network layers. Operators are identified by a tuple −

<name, domain, version>

Where,

  • name: The name of the operator.
  • domain: The namespace to which the operator belongs.
  • version: The version of the operator (to track updates and changes).

Core Operators in ONNX

Core operators are the standard set of operators that come with ONNX and ONNX-ML. These operators are highly optimized and supported by any ONNX-compatible product. These operators are designed to cover most common machine learning tasks and cannot generally be meaningfully further decomposed into simpler operations.

Key Features of Core Operators −

  • These are standard operators defined within the ONNX framework.
  • The ai.onnx domain contains 124 operators, while the ai.onnx.ml domain (focused on machine learning tasks) contains 19 operators.
  • Core operators support various problem areas such as image classification, recommendation systems, and natural language processing.

The ai.onnx Domain Operators

Following are the list of ai.onnx operators −

S.No Operator
1Abs
2Acos
3Acosh
4Add
5AffineGrid
6And
7ArgMax
8ArgMin
9Asin
10Asinh
11Atan
12Atanh
13AveragePool
14BatchNormalization
15Bernoulli
16BitShift
17BitwiseAnd
18BitwiseNot
19BitwiseOr
20BitwiseXor
21BlackmanWindow
22Cast
23CastLike
24Ceil
25Celu
26CenterCropPad
27Clip
28Col2Im
29Compress
30Concat
31ConcatFromSequence
32Constant
33ConstantOfShape
34Conv
35ConvInteger
36ConvTranspose
37Cos
38Cosh
39CumSum
40DFT
41DeformConv
42DepthToSpace
43DequantizeLinear
44Det
45Div
46Dropout
47DynamicQuantizeLinear
48Einsum
49Elu
50Equal
51Erf
52Exp
53Expand
54EyeLike
55Flatten
56Floor
57GRU
58Gather
59GatherElements
60GatherND
61Gelu
62Gemm
63GlobalAveragePool
64GlobalLpPool
65GlobalMaxPool
66Greater
67GreaterOrEqual
68GridSample
69GroupNormalization
70HammingWindow
71HannWindow
72HardSigmoid
73HardSwish
74Hardmax
75Identity
76If
77ImageDecoder
78InstanceNormalization
79IsInf
80IsNaN
81LRN
82LSTM
83LayerNormalization
84LeakyRelu
85Less
86LessOrEqual
87Log
88LogSoftmax
89Loop
90LpNormalization
91LpPool
92MatMul
93MatMulInteger
94Max
95MaxPool
96MaxRoiPool
97MaxUnpool
98Mean
99MeanVarianceNormalization
100MelWeightMatrix
101Min
102Mish
103Mod
104Mul
105Multinomial
106Neg
107NonMaxSuppression
108NonZero
109Not
110OneHot
111Optional
112Or
113PRelu
114Pad
115Pow
116QLinearAdd
117QLinearAveragePool
118QLinearConcat
119QLinearConv
120QLinearLeakyRelu
121QLinearMul
122QLinearSigmoid
123QLinearSoftmax
124QLinearTranspose

The ai.onnx.ml Domain Operators

Below are the list of all available operators in the ai.onnx.ml domain.

S.No Operator
1ArrayFeatureExtractor
2Binarizer
3CastMap
4CategoryMapper
5DictVectorizer
6FeatureVectorizer
7Imputer
8LabelEncoder
9LinearClassifier
10LinearRegressor
11Normalizer
12OneHotEncoder
13SVMClassifier
14SVMRegressor
15Scaler
16TreeEnsemble
17TreeEnsembleClassifier
18TreeEnsembleRegressor
19ZipMap

Custom Operators in ONNX

In addition to core operators, ONNX allows developers to define custom operators for more specialized or non-standard tasks.

  • If a particular operation does not exist in the ONNX operator set, or if a developer creates a new technique or custom activation function, they can define a custom operator.
  • Custom operators are identified by a custom domain name, distinguishing them from core operators.
Advertisements