Tracking issue for supported ONNX operators
This is a tracking issue listing which ONNX operators are currently supported.
Some things to note:
- Support for an operator does not mean that all attributes or data types listed in the current spec are supported.
- Some operators require additional dependencies to support. These typically require enabling additional crate features. For example the
Random*ops require enabling therandomcrate feature - Some operators are deprecated in the spec. Their non-deprecated replacements are implemented. This includes: Scatter, Upsample.
- Operators are usually implemented after finding a model that needs them. These models then serve as an initial test case. If you need an operator which is not currently listed as supported, it is helpful (but not essential) if you can point to an open source ONNX model which needs it.
Script used to generate list
from bs4 import BeautifulSoup
import requests
# URL of the ONNX operators page
url = "https://onnx.ai/onnx/operators/"
# Path to FlatBuffers schema listing supported ops.
schema_path = "src/schema.fbs"
# Fetch ONNX operators page and extract the list of operators.
#
# This assumes the operators are listed in the first table on the page and
# that the operator name is the first column.
response = requests.get(url)
soup = BeautifulSoup(response.content, 'html.parser')
operator_names = []
table = soup.find('table')
rows = table.find_all('tr')
for row in rows:
cols = row.find_all('td')
if len(cols) >= 1:
operator_name = cols[0].text.strip()
operator_names.append(operator_name)
# Scan FlatBuffers schema and extract supported operator names
supported_ops = set()
with open(schema_path) as fp:
in_operator_type_enum = False
for line in fp:
if line.startswith('enum OperatorType'):
in_operator_type_enum = True
continue
if line.startswith('}') and in_operator_type_enum:
break
if in_operator_type_enum:
op_name = line.strip().replace(',', '')
supported_ops.add(op_name)
# List operators and support status
for operator in operator_names:
if operator in supported_ops:
print(f"- [x] {operator}")
else:
print(f"- [ ] {operator}")
Operator list
- [x] Abs
- [x] Acos
- [ ] Acosh
- [x] Add
- [ ] AffineGrid
- [x] And
- [x] ArgMax
- [x] ArgMin
- [x] Asin
- [ ] Asinh
- [x] Atan
- [ ] Atanh
- [x] AveragePool
- [x] BatchNormalization
- [ ] Bernoulli
- [ ] BitShift
- [ ] BitwiseAnd
- [ ] BitwiseNot
- [ ] BitwiseOr
- [ ] BitwiseXor
- [ ] BlackmanWindow
- [x] Cast
- [x] CastLike
- [x] Ceil
- [ ] Celu
- [ ] CenterCropPad
- [x] Clip
- [ ] Col2Im
- [ ] Compress
- [x] Concat
- [x] ConcatFromSequence (https://github.com/robertknight/rten/pull/859)
- [x] Constant (N/A - Constants are handled at model conversion time)
- [x] ConstantOfShape
- [x] Conv
- [x] ConvInteger
- [x] ConvTranspose
- [x] Cos
- [ ] Cosh
- [x] CumSum
- [ ] DFT
- [ ] DeformConv
- [x] DepthToSpace (https://github.com/robertknight/rten/pull/468)
- [x] DequantizeLinear
- [ ] Det
- [x] Div
- [x] Dropout (https://github.com/robertknight/rten/pull/652)
- [x] DynamicQuantizeLinear
- [x] Einsum
- [x] Elu
- [x] Equal
- [x] Erf
- [x] Exp
- [x] Expand
- [x] EyeLike (https://github.com/robertknight/rten/pull/741)
- [x] Flatten
- [x] Floor
- [x] GRU
- [x] Gather
- [x] GatherElements
- [x] GatherND
- [x] Gelu
- [x] Gemm
- [x] GlobalAveragePool
- [ ] GlobalLpPool
- [x] GlobalMaxPool (https://github.com/robertknight/rten/pull/1072)
- [x] Greater
- [x] GreaterOrEqual
- [x] GridSample (https://github.com/robertknight/rten/pull/867)
- [ ] GroupNormalization
- [ ] HammingWindow
- [ ] HannWindow
- [x] HardSigmoid
- [x] HardSwish
- [ ] Hardmax
- [x] Identity
- [x] If
- [ ] ImageDecoder
- [x] InstanceNormalization
- [x] IsInf (https://github.com/robertknight/rten/pull/837)
- [x] IsNaN (https://github.com/robertknight/rten/pull/837)
- [ ] LRN
- [x] LSTM
- [x] LayerNormalization
- [x] LeakyRelu
- [x] Less
- [x] LessOrEqual
- [x] Log
- [x] LogSoftmax
- [x] Loop (https://github.com/robertknight/rten/pull/855)
- [ ] LpNormalization
- [ ] LpPool
- [x] MatMul
- [x] MatMulInteger
- [x] Max
- [x] MaxPool
- [ ] MaxRoiPool
- [ ] MaxUnpool
- [x] Mean
- [ ] MeanVarianceNormalization
- [ ] MelWeightMatrix
- [x] Min
- [ ] Mish
- [x] Mod
- [x] Mul
- [ ] Multinomial
- [x] Neg
- [ ] NegativeLogLikelihoodLoss
- [x] NonMaxSuppression
- [x] NonZero
- [x] Not
- [x] OneHot
- [ ] Optional
- [ ] OptionalGetElement
- [ ] OptionalHasElement
- [x] Or
- [x] PRelu (https://github.com/robertknight/rten/pull/888)
- [x] Pad
- [x] Pow
- [ ] QLinearConv
- [ ] QLinearMatMul
- [x] QuantizeLinear
- [ ] RNN
- [x] RandomNormal
- [x] RandomNormalLike
- [x] RandomUniform
- [x] RandomUniformLike
- [x] Range
- [x] Reciprocal
- [ ] ReduceL1
- [x] ReduceL2
- [ ] ReduceLogSum
- [ ] ReduceLogSumExp
- [x] ReduceMax
- [x] ReduceMean
- [x] ReduceMin
- [x] ReduceProd
- [x] ReduceSum
- [x] ReduceSumSquare
- [ ] RegexFullMatch
- [x] Relu
- [x] Reshape
- [x] Resize
- [ ] ReverseSequence
- [ ] RoiAlign
- [x] Round
- [x] STFT (https://github.com/robertknight/rten/pull/921)
- [ ] Scan
- [ ] Scatter (deprecated. The replacement ScatterElements is implemented)
- [x] ScatterElements
- [x] ScatterND
- [ ] Selu
- [x] SequenceAt (https://github.com/robertknight/rten/pull/858)
- [x] SequenceConstruct (https://github.com/robertknight/rten/pull/864)
- [x] SequenceEmpty (https://github.com/robertknight/rten/pull/858)
- [x] SequenceErase (https://github.com/robertknight/rten/pull/865)
- [x] SequenceInsert (https://github.com/robertknight/rten/pull/858)
- [x] SequenceLength (https://github.com/robertknight/rten/pull/863)
- [ ] SequenceMap
- [x] Shape
- [ ] Shrink
- [x] Sigmoid
- [x] Sign
- [x] Sin
- [ ] Sinh
- [x] Size
- [x] Slice
- [x] Softmax
- [ ] SoftmaxCrossEntropyLoss
- [x] Softplus
- [ ] Softsign
- [ ] SpaceToDepth
- [x] Split
- [x] SplitToSequence (https://github.com/robertknight/rten/pull/860)
- [x] Sqrt
- [x] Squeeze
- [ ] StringConcat
- [ ] StringNormalizer
- [ ] StringSplit
- [x] Sub
- [x] Sum
- [x] Tan
- [x] Tanh
- [ ] TfIdfVectorizer
- [ ] ThresholdedRelu
- [x] Tile
- [x] TopK
- [x] Transpose
- [x] Trilu
- [ ] Unique
- [x] Unsqueeze
- [ ] Upsample (deprecated. The replacement Resize is implemented)
- [x] Where
- [x] Xor
Strings that look like ONNX operator names (match "[A-Z][A-Za-z]+"') grepped from torch/onnx/symbolic_opset*.py. This gives a rough idea of which ONNX operators models exported from PyTorch might actually use.
Abs
Acos
Add
Affine
And
ArgMax
ArgMin
Asin
Atan
AveragePool
BatchNormalization
Bernoulli
BitShift
Bool
CRD
Cast
Ceil
Celu
Clip
Concat
ConcatFromSequence
Constant
ConstantFill
ConstantOfShape
Conv
ConvTranspose
Cos
CumSum
Delete
DepthToSpace
DequantizeLinear
Det
Div
Dropout
DynamicSlice
Einsum
Elu
Equal
Erf
Exp
Expand
EyeLike
Flatten
Floor
GRU
Gather
GatherElements
GatherND
Gemm
GlobalAveragePool
GlobalMaxPool
Greater
GreaterOrEqual
GridSample
HardSigmoid
HardSwish
Identity
If
InstanceNormalization
IsInf
IsNaN
LEFT
LSTM
LayerNormalization
LeakyRelu
Less
LessOrEqual
Log
LogSoftmax
Loop
MatMul
Max
MaxPool
Min
Mod
Mul
Multinomial
Neg
NegativeLogLikelihoodLoss
NonZero
Not
OneHot
OptionalGetElement
OptionalHasElement
Or
PRelu
Pad
Pow
QuantizeLinear
RIGHT
RNN
RandomNormal
RandomNormalLike
RandomUniform
RandomUniformLike
Range
Reciprocal
ReduceLogSumExp
ReduceMax
ReduceMean
ReduceMin
ReduceProd
ReduceSum
Relu
Reshape
Resize
Round
STFT
ScaledTanh
Scatter
ScatterElements
ScatterND
Selu
SequenceAt
SequenceConstruct
SequenceEmpty
SequenceErase
SequenceInsert
SequenceLength
Shape
Sigmoid
Sign
Sin
Size
Slice
Softmax
SoftmaxCrossEntropyLoss
Softplus
Softsign
Sort
Split
SplitToSequence
Sqrt
Squeeze
Sub
Tan
Tanh
Tensor
Tensordot
ThresholdedRelu
Tile
TopK
Transpose
Trilu
Unfold
Unique
Unsqueeze
Upsample
VALID
Where
Xor
It would be cool if you could pin this issue, and link to it from README. For a newcomer, it was easier to gauge the state of the project (and that I didn't enable a feature) than going through schema currently linked to in the README.
Hello @Caellian, which operators did you run into issues with? Given that you mentioned enabling a feature, I'm guessing it was one of the Random* ops? There is an issue about producing a more helpful error when an operator is supported, but not enabled due to the current crate features.
I'm guessing it was one of the Random* ops?
Yup, it was RandomNormalLike, figured it out by searching the code for it and seeing cfg attribute on one use, after seeing it marked as supported here.