ByOp#

Ops#

This section lists all ONNX operators grouped by domain. Each domain page shows the latest version of every operator together with its inputs, outputs, attributes and type constraints.

Patterns#

This table is generated from the patterns registered by the installed onnx_light package. Summaries come from the C++ Doxygen comments; follow the C++ class links to see the rewrite graphs.

#

Pattern

Summary

1

AttentionGQA (attention)

Python — Converts cached grouped-query attention into ONNX Attention cache inputs and outputs.

2

BatchNormalization (normalization)

Python — Removes an identity BatchNormalization in inference mode.

3

BatchNormalizationTraining (normalization)

Python — Expands training BatchNormalization into primitive operators.

4

Cast (canonicalization)

Python — Canonicalizes a Cast to Identity when its input already has the target type.

5

CastCast (canonicalization)

Python — Canonicalizes consecutive Cast nodes when a single conversion is equivalent.

6

CastCastBinary (canonicalization)

Python — Moves matching floating-point Cast nodes after a binary arithmetic operation.

7

CastLayerNormalizationCast (normalization)

Python — Moves a normalization from its stash type back to the original element type.

8

CastOpCast (canonicalization)

Python — Moves an operation from a temporary floating-point type to its result type.

9

ClipClip (canonicalization)

Python — Merges two consecutive Clip nodes when one defines the minimum and the other the maximum.

10

ConcatEmpty (collections)

Python — Removes Concat inputs that are empty along the concatenation axis.

11

ConcatGather (collections)

Python — Simplifies Gather(Concat(...), cst_index) when the index is a constant single-element int64 tensor and every Concat input is a 1-D tensor of a statically known size.

12

ConcatReshape (reshape)

Python — Replaces dynamic dimensions in a concatenated Reshape target with one inferred dimension.

13

ConcatSliceElimination (collections)

Python — Removes a Concat whose consumers are exact, non-overlapping Slice nodes that recover every input in order along the concatenation axis.

14

ConcatTwiceUnary (collections)

Python — Pushes a shape-preserving unary operator through a Concat(x, x) so that Unary(Concat(x, x)) becomes Concat(Unary(x), Unary(x)), exposing the shared Unary(x) for common-subexpression elimination.

15

ConstantToInitializer (canonicalization)

Python — Replaces a Constant node by an initializer and an Identity node.

16

ConvAddFusion (canonicalization)

Python — Fuses a channel-wise Add following a Conv into the Conv bias.

17

ConvBatchNormalizationFusion (canonicalization)

Python — Fuses inference BatchNormalization following a Conv into the Conv weights and bias.

18

ConvBiasNull (canonicalization)

Python — Removes a null (all-zero) bias input from a Conv node.

19

ConvMulFusion (canonicalization)

Python — Fuses a scalar or channel-wise Mul following a Conv into its weights and optional bias.

20

DivMul (algebra)

Python — Fuses a reciprocal followed by multiplication into one division.

21

Dropout (canonicalization)

Python — Replaces an eligible Dropout by an Identity node.

22

Expand (expand)

Python — Removes an Expand that does not change the shape of its input.

23

ExpandBroadcast (expand)

Python — Drops an Expand feeding an element-wise binary operator.

24

ExpandSwap (expand)

Python — Moves an Expand past a following unary-like operator.

25

ExpandUnsqueezeExpand (expand)

Python — Fuses Expand, Unsqueeze and Expand into Unsqueeze then Expand.

26

FunctionAttention (attention)

Python — Fuses a masked scaled-dot-product attention graph into a local function.

27

FunctionAttentionGQA (attention)

Python — Moves matching GQA repeat-interleave branches into a LocalAttention function.

28

FunctionCausalMask (attention)

Python — Fuses a causal-mask index construction into a local function.

29

FunctionCausalMaskMulAdd (attention)

Python — Fuses an additive causal-mask index construction into a local function.

30

FunctionCosSinCache (attention)

Python — Fuses cosine and sine rotary-cache generation into a local function.

31

FunctionHalfRotaryEmbedding (attention)

Python — Fuses the canonical half-rotary decomposition into a local function.

32

GatherConcat (collections)

Python — Simplifies Gather(Concat(..., X, ..., axis=0), cst) into Gather(X, cst - offset) when exactly one Concat input X is non-constant, all others are constants of known size, X is 1-D, and every requested index falls inside X’s slice of the concatenation.

33

GatherGather (collections)

Python — Composes two consecutive axis=0 Gather nodes with constant indices into a single Gather.

34

GatherShape (collections)

Python — Simplifies Gather(Shape(X), indices) into Shape(X, start, end) when indices is a constant int64 scalar or a contiguous ascending 1-D range.

35

GatherSliceToSplit (collections)

Python — Replaces compatible sibling scalar Gather and contiguous Slice ranges covering a complete static axis with one Split. Scalar Gather outputs are restored with Squeeze.

36

GatherToSlice (collections)

Python — Replaces a Gather selecting a constant scalar index, a constant single-element vector index, or a constant arithmetic-progression vector of indices (a “range” with a fixed, strictly ascending step) by an equivalent Slice. Slice is generally cheaper to execute than Gather and, unlike Gather, it never triggers a data-dependent gather kernel.

37

GatherUpstreamPropagation (collections)

Python — Moves a scalar or vector constant-index Gather upstream across one compatible producer node, so that the producer runs on the smaller (already gathered) tensor(s) instead of the original full-size ones.

38

GathersSplit (collections)

Python — Merges several sibling Gather nodes reading consecutive constant indices 0, 1, ..., n-1 on the same axis of a common input into a single Split (followed by Squeeze nodes when the indices are scalars).

39

Gelu (normalization)

Python — Fuses the tanh approximation of Gelu.

40

GemmSumFusion (matmul)

Python — Fuses a two-input Sum following an unbiased Gemm into the Gemm bias input.

41

GemmTranspose (matmul)

Python — Exposes a constant Gemm weight transpose while preserving Gemm semantics.

42

Identity (canonicalization)

Python — Replaces no-op operations by an Identity node.

43

InitializerUnsqueezeCast (canonicalization)

Python — Folds an initializer’s Unsqueeze and Cast into the initializer consumed by Add.

44

LabelEncoderFusion (traditionalml)

Python — Composes two consecutive ai.onnx.ml::LabelEncoder mappings, including propagation of the first encoder’s default through the second encoder.

45

LayerNormalization (normalization)

Python — Fuses an explicit layer-normalization decomposition.

46

LayerNormalizationScale (normalization)

Python — Folds a following affine transform into LayerNormalization parameters.

47

LeakyRelu (normalization)

Python — Fuses a Where-based LeakyRelu decomposition.

48

LinearAttention (attention)

Python — Fuses a single-token linear-attention recurrence into LinearAttention.

49

MatMulAdd (matmul)

Python — Fuses an Add bias into a MatMul or Gemm.

50

MatMulBatchNormalizationFusion (matmul)

Python — Folds inference BatchNormalization parameters into a constant MatMul weight.

51

MatMulReshape2Of3 (matmul)

Python — Normalizes adjacent Reshapes around a MatMul to the final batch shape.

52

MatMulScaleFusion (matmul)

Python — Absorbs one scalar Mul or safe Div adjacent to a rank-two MatMul.

53

MaxRelu (normalization)

Python — Replaces a maximum with scalar zero by Relu.

54

MulMulMatMul (matmul)

Python — Moves scalar factors from both MatMul inputs to one multiplication after the MatMul.

55

MulMulMulScalar (algebra)

Python — Combines the scalar constants from three nested Mul or Div nodes.

56

MulUnsqueezeUnsqueeze (layout)

Python — Moves equal, unshared Unsqueeze operations after a Mul.

57

NotNot (canonicalization)

Python — Fuses two consecutive Not nodes into an Identity.

58

NotWhere (expand)

Python — Rewrites Where(Not(c), x, y) into Where(c, y, x).

59

PadConv (canonicalization)

Python — Fuses a Pad node followed by a Conv node into a single Conv node whose pads attribute absorbs the spatial padding.

60

PadPadFusion (canonicalization)

Python — Merges two adjacent constant-mode Pad nodes with equal constant values.

61

PreShapeNodeElimination (collections)

Python — Removes a Cast node whose output only feeds Shape consumers, redirecting each such Shape node directly to the Cast’s input.

62

RMSNormalization (normalization)

Python — Fuses an explicit root-mean-square normalization decomposition.

63

RMSNormalizationMul (normalization)

Python — Folds a constant post-scale into RMSNormalization.

64

ReduceArgTopK (algebra)

Python — Fuses matching ReduceMin/ReduceMax and ArgMin/ArgMax nodes into TopK with K=1.

65

ReduceReshape (reshape)

Python — Fuses a dimension-removing Reshape into a reduction.

66

ReduceSumNormalize (algebra)

Python — Moves a Cast-ReduceSum-Mul-Sub-Cast normalization chain to the result type.

67

ReluClipFusion (canonicalization)

Python — Removes a Relu immediately followed by a Clip whose effective minimum is non-negative.

68

Reshape (reshape)

Python — Removes a Reshape whose constant target already equals its input shape.

69

Reshape2Of3 (reshape)

Python — Moves a binary operation to the common outer shape represented by surrounding Reshapes.

70

ReshapeMatMulReshape (matmul)

Python — Removes batch-flattening Reshapes around a MatMul.

71

ReshapeReshape (reshape)

Python — Composes two consecutive Reshapes into one.

72

ReshapeReshapeBinary (reshape)

Python — Moves equal input Reshapes after an element-wise binary operation.

73

ReshapeSqueeze (reshape)

Python — Fuses a Squeeze into the constant target of a preceding Reshape.

74

RotaryConcatPart (attention)

Python — Collapses two zero-padded rotary branches into Split, Neg, and Concat.

75

RotaryEmbedding (attention)

Python — Replaces a half-rotary local function and doubled caches with RotaryEmbedding.

76

STFTFusion (canonicalization)

Python — Fuses a canonical convolution-based DFT into a standard ONNX STFT.

77

SameChildren (algebra)

Python — Merges pairs of identical sibling nodes, and any identical descendant chains.

78

SameChildrenFromInput (algebra)

Python — Merges identical nodes that consume the same graph input.

79

SequenceConstructAt (collections)

Python — Replaces SequenceConstruct(x0, x1, ...) followed by the matching SequenceAt(seq, 0), SequenceAt(seq, 1), … with one Identity per SequenceAt, forwarding the original tensor directly.

80

ShapeBasedConcatExpand (expand)

Python — Simplifies a dynamic Concat used as an Expand target shape.

81

ShapeBasedEditDistanceReshape (reshape)

Python — Materializes a Concat-built Reshape target from inferred input and output shapes.

82

ShapeBasedExpandBroadcast (expand)

Python — Removes dynamic Expand nodes before a broadcasting binary operator.

83

ShapeBasedExpandBroadcastMatMul (expand)

Python — Removes dynamic Expand nodes before MatMul.

84

ShapeBasedExpandCastWhereSwap (expand)

Python — Moves an Expand after Cast and Where.

85

ShapeBasedExpandSwap (expand)

Python — Moves input Expand nodes after a broadcasting binary operator.

86

ShapeBasedIdentity (algebra)

Python — Replaces a shape-preserving Slice by an Identity.

87

ShapeBasedMatMulToMul (matmul)

Python — Replaces a MatMul with unit reduction dimensions by element-wise Mul.

88

ShapeBasedReshapeIsSqueeze (reshape)

Python — Replaces a Reshape or all-one Expand that only inserts or removes unit dimensions.

89

ShapeBasedSameChildren (algebra)

Python — Merges Expand or Reshape siblings whose inferred output shapes are equal.

90

ShapeBasedShapeShapeAdd (algebra)

Python — Recognizes an Add fed by two Shape nodes but performs no rewrite.

91

ShapeBasedStaticExpand (expand)

Python — Replaces a dynamic Expand target with an equivalent constant target.

92

ShapeTranspose (collections)

Python — Replaces Shape(Transpose(X, perm)) by Gather(Shape(X), perm) so the expensive Transpose on the full data tensor is avoided.

93

ShapedBasedReshape (reshape)

Python — Removes a same-rank Reshape whose target copies every dimension but the last.

94

SliceConcatToSpaceToDepth (collections)

Python — Replaces the canonical rank-4 four-phase slicing and channel concatenation used by focus layers with the standard ONNX SpaceToDepth(blocksize=2).

95

SliceElimination (collections)

Python — Replaces a full-range Slice by an Identity.

96

SliceSlice (collections)

Python — Merges two consecutive Slice nodes acting on disjoint axes into a single Slice whose starts / ends / axes (and steps when present) are the concatenation of the two operand vectors.

97

SlicesSplit (collections)

Python — Merges several sibling Slice nodes that partition a common input along a single axis into contiguous, non-overlapping ranges into one Split.

98

SoftmaxCrossEntropyLossCast (normalization)

Python — Fuses a float16 mean cross-entropy loss decomposition.

99

SplitConcat (collections)

Python — Replaces a Split immediately followed by a Concat that re-joins all of its outputs, in order and on the same axis, with a single Identity.

100

SplitToSequenceSequenceAt (collections)

Python — Replaces SplitToSequence(x, [split], axis=a) followed by the matching SequenceAt(seq, 0), SequenceAt(seq, 1), … with a single Split.

101

SqueezeAdd (layout)

Python — Moves equal Squeeze operations after an Add.

102

SqueezeBinaryUnsqueeze (layout)

Python — Cancels a scalar-producing Squeeze/binary/Unsqueeze chain by expanding the scalar right operand instead.

103

SqueezeUnsqueeze (unsqueeze)

Python — Simplifies a Squeeze/Unsqueeze pair into Identity or Squeeze.

104

StaticConcatReshape (reshape)

Python — Replaces the sole dynamic element of a concatenated Reshape target with [-1].

105

Sub1Mul (algebra)

Python — Rewrites multiplication by 1 - x into a product followed by subtraction.

106

SwapExpandReshape (expand)

Python — Swaps an Expand with a following constant-shape Reshape.

107

SwapExpandUnsqueeze (expand)

Python — Swaps an Expand and a following Unsqueeze.

108

SwapRangeAddScalar (algebra)

Python — Moves a shape-[1] second Add input from after Range into its start and limit inputs.

109

SwapUnary (algebra)

Python — Moves a rank-preserving layout operation after a compatible following operation.

110

SwapUnsqueezeTranspose (layout)

Python — Swaps an unshared Unsqueeze and Transpose, remapping both axes and permutation.

111

SwitchOrderBinary (algebra)

Python — Reassociates nested Add or Mul nodes to reduce broadcasting rank.

112

SwitchReshapeActivation (matmul)

Python — Moves an element-wise activation before a Reshape or Transpose.

113

TransposeEqualReshape (layout)

Python — Replaces a Transpose that only repositions size-one axes around at most one other dimension with a Reshape.

114

TransposeGather (transpose)

Python — Removes an unnecessary Transpose feeding a Gather with a scalar index.

115

TransposeMatMul (matmul)

Python — Absorbs rank-two input Transposes into Gemm transpose attributes.

116

TransposeReshapeMatMul (matmul)

Python — Swaps a last-two-dimension Transpose with a following Reshape on one MatMul input.

117

TransposeReshapeTranspose (layout)

Python — Moves a constant Reshape across one of two adjacent Transpose nodes when the input and target dimensions can be aligned by merging or splitting contiguous dimensions.

118

TransposeToInitializer (transpose)

Python — Folds a Transpose whose input is an initializer.

119

TransposeTranspose (transpose)

Python — Merges two consecutive Transpose nodes into a single one.

120

TreeEnsemble (traditionalml)

Python — Replaces classic TreeEnsembleRegressor and TreeEnsembleClassifier nodes with the unified ai.onnx.ml TreeEnsemble operator from opset 5.

121

UnsqueezeEqual (expand)

Python — Moves Equal(x, c) after a compatible sibling Unsqueeze(x, a) and preserves the rank of Equal(Unsqueeze(x, a), Unsqueeze(y, a)).

122

UnsqueezeOrSqueezeReshape (reshape)

Python — Removes a Squeeze or Unsqueeze immediately before a Reshape.

123

UnsqueezeReshape (reshape)

Python — Collapses a specific Unsqueeze-Reshape sequence into one Unsqueeze.

124

UnsqueezeShape (collections)

Python — Replaces Shape(Unsqueeze(X, axes)) by a Concat of Shape(X) slices interleaved with constant [1] tensors at the inserted axis positions.

125

UnsqueezeUnsqueeze (unsqueeze)

Python — Merges two consecutive Unsqueeze nodes into a single one.

126

WhereAdd (expand)

Python — Rewrites an additive mask or factors a common term from Where branches.

MemoryPeak#

This table lists the peak-memory functions registered by the installed onnx_light package.

Operator

Domain

Device

APIs

Attention

ai.onnx

CPU / default

C++ / Python

LinearAttention

ai.onnx

CPU / default

C++ / Python