Back to Onnxruntime

Webnn Operators

js/web/docs/webnn-operators.md

1.25.19.6 KB
Original Source

Operators Support Table

The following table shows ONNX operators and the supported opset domain/versions in WebNN EP by ONNX Runtime Web. For example, 7-12, 13+ means ONNX Runtime Web currently supports opset version 7 to 12, 13 and above.

(Note: ONNX Runtime only guarantees support for models stamped with opset version 7 or above for opset domain 'ai.onnx'.)

The WebNN API is available in the latest versions of Chrome and Edge on Windows, Linux, macOS, Android, and ChromeOS behind an <i>"Enables WebNN API"</i> flag. The operator support status may vary across these platforms. Check the WebNN status for the latest implementation details.

OperatorOpsetWebNN APIComments
Absai.onnx(7-12, 13+)abs
Addai.onnx(7-12, 13, 14+)add
Andai.onnx(7+)logicalAnd
ArgMaxai.onnx(7-10, 11, 12, 13+)argMax
ArgMinai.onnx(7-10, 11, 12, 13+)argMin
AveragePoolai.onnx(7-9, 10, 11, 12-18, 19+)averagePool2dOnly supports 4-D input, 2-D 'kernel_shape'
BatchNormalizationai.onnx(7-8, 9-13, 14, 15+)batchNormalizationOnly supports 'training_mode' value is 0, one output
Castai.onnx(7-8, 9-12, 13-18, 19-20, 21+)cast
Ceilai.onnx(7-12, 13+)ceil
Clipai.onnx(7-10, 11, 12, 13+)clamp
Concatai.onnx(7-10, 11-12, 13+)concat
Convai.onnx(7-10, 11+)conv2dOnly supports 3-D or 4-D input and 'W' (weight)
ConvIntegerai.onnx(10+)cast, conv2d, dequantizeLinearOnly supports 3-D or 4-D input and 'W' (weight)
ConvTransposeai.onnx(7-10, 11+)convTranspose2dOnly supports 3-D or 4-D input and 'W' (weight)
Cosai.onnx(7+)cos
CumSumai.onnx(11-13, 14+)cumulativeSum'axis' input should be a constant
Divai.onnx(7-12, 13, 14+)div
DepthToSpaceai.onnx(7-10, 11-12, 13+)reshape, transpose
DequantizeLinearai.onnx(10-12, 13-18, 19-20, 21-22, 23+)dequantizeLinear, reshape
Dropoutai.onnx(7-9, 10-11, 12, 13-21, 22+)identityOnly supports test mode
DynamicQuantizeLinearai.onnx(11+)cast, clamp, div, div, max, min, quantizeLinear, reduceMax, reduceMin, reshape, roundEven, sub
Einsumai.onnx(12+)reshape, transpose, matmul, reduceSum, mul, triangular
Eluai.onnx(7+)elu
Equalai.onnx(7-10, 11-12, 13-18, 19+)equal
Erfai.onnx(7-9, 10-12, 13+)erf
Expai.onnx(7-12, 13+)exp
Expandai.onnx(8-12, 13+)expand'shape' input should be a constant
Flattenai.onnx(7-8, 9-10, 11-12, 13-20, 21+)reshape
Floorai.onnx(7-12, 13+)floor
Gatherai.onnx(7-10, 11-12, 13+)gather
GatherBlockQuantizedcom.microsoft(1+)dequantizeLinear, gather
GatherElementsai.onnx(11-12, 13+)gatherElements
GatherNDai.onnx(11, 12, 13+)gatherNDOnly supports 'batch_dims' == 0
Geluai.onnx(20+)gelu
Gemmai.onnx(7-8, 9-10, 11-12, 13+)gemm
GlobalAveragePoolai.onnx(7+)averagePool2dOnly supports 4-D input
GlobalMaxPoolai.onnx(7+)maxPool2dOnly supports 4-D input
GlobalLpPoolai.onnx(7+)l2Pool2dOnly supports 4-D input, 'p' value is 2
Greaterai.onnx(7-8, 9-12, 13+)greater
GreaterOrEqualai.onnx(12-15, 16+)greaterOrEqual
GroupQueryAttentioncom.microsoft(1+)add, cast, concat, constant, cumulativeSum, div, expand, lesser, matmul, reshape, scatterND, softmax, transpose, whereOnly supports input total_sequence_length is constant and past_sequence_length of past kv equals to present_sequence_length of present kv.
GRUai.onnx(7-13, 14-21, 22+)gruOnly supports 'layout' == 0. 'clip' is not supported. The activation functions in 'activations' must be one of 'Relu', 'Tanh', 'Sigmoid'. Forward and backward activations must be the same if bidirectional. 'sequence_lens' if present should be constant with values equal to the first dimension length of input 'X'
HardSigmoidai.onnx(7+)hardSigmoid
HardSwishai.onnx(14+)hardSwish
Identityai.onnx(7-13, 14-15, 16-18, 19-20, 21+)identity
InstanceNormalizationai.onnx(7+)instanceNormalization
IsNaNai.onnx(9-12, 13-19, 20+)isNaN
IsInfai.onnx(10-19, 20+)isInfinite, equal, greater
LayerNormalizationai.onnx(7-16, 17+)layerNormalization
LeakyReluai.onnx(7-15, 16+)leakyRelu
Lessai.onnx(7-8, 9-12, 13+)lesser
LessOrEqualai.onnx(12-15, 16+)lesserOrEqual
Logai.onnx(7-12, 13+)log
LpPoolai.onnx(7-10, 11-17, 18+)l2Pool2dOnly supports 4-D input, 2-D 'kernel_shape', 'p' value is 2
LRNai.onnx(7-12, 13+)pad, averagePool2d, transpose, add, mul, pow, div
LSTMai.onnx(7-13, 14-21, 22+)lstmOnly supports 'layout' == 0, 'input_forget' == 0. 'clip' is not supported. The activation functions in 'activations' must be one of 'Relu', 'Tanh', 'Sigmoid'. Forward and backward activations must be the same if bidirectional. 'sequence_lens' if present should be constant with values equal to the first dimension length of input 'X'
MatMulai.onnx(7-8, 9-12, 13+)matmul
MatMulIntegerai.onnx(10+)cast, dequantizeLinear, matmul
MatMulNBitscom.microsoft(1+)add, dequantizeLinear, matmul, reshape, transposeInputs 'B' and 'zero_points' (if present) should be constants, input 'g_idx' is not supported, only bits=4 is supported
Maxai.onnx(7, 8-11, 12, 13+)max
MaxPoolai.onnx(7, 8-9, 10, 11, 12+)maxPool2dOnly supports 4-D input, 2-D 'kernel_shape', 'storage_order' != 1, one output
Minai.onnx(7, 8-11, 12, 13+)min
Mulai.onnx(7-12, 13, 14+)mul
MultiHeadAttentioncom.microsoft(1+)add, cast, concat, constant, div, matmul, reshape, softmax, transposeDoes not support inputs bias, key_padding_mask, past_sequence_length, or cache_indirection. Does not support output qk
Negai.onnx(7-12, 13+)neg
Notai.onnx(7+)logicalNot
Orai.onnx(7+)logicalOr
Padai.onnx(7-10, 11-12, 13-17, 18, 19-20, 21+)padmodes == 'wrap' is not supported
Powai.onnx(7-11, 12, 13-14, 15+)pow
PReluai.onnx(7-8, 9-15, 16+)prelu
QuantizeLinearai.onnx(10-12, 13-18, 19-20, 21-22, 23+)quantizeLinear, reshape
Reciprocalai.onnx(7-12, 13+)reciprocal
Roundai.onnx(11-21, 22+)roundEven
ReduceL1ai.onnx(7-10, 11-12, 13-17, 18+)reduceL1Input 'axes' if present should be a constant
ReduceL2ai.onnx(7-10, 11-12, 13-17, 18+)reduceL2Input 'axes' if present should be a constant
ReduceLogSumai.onnx(7-10, 11-12, 13-17, 18+)reduceLogSumInput 'axes' if present should be a constant
ReduceLogSumExpai.onnx(7-10, 11-12, 13-17, 18+)reduceLogSumExpInput 'axes' if present should be a constant
ReduceMaxai.onnx(7-10, 11, 12, 13-17, 18-19, 20+)reduceMaxInput 'axes' if present should be a constant
ReduceMeanai.onnx(7-10, 11-12, 13-17, 18+)reduceMeanInput 'axes' if present should be a constant
ReduceMinai.onnx(7-10, 11, 12, 13-17, 18-19, 20+)reduceMinInput 'axes' if present should be a constant
ReduceProdai.onnx(7-10, 11-12, 13-17, 18+)reduceProductInput 'axes' if present should be a constant
ReduceSumai.onnx(7-10, 11-12, 13+)reduceSumInput 'axes' if present should be a constant
ReduceSumSquareai.onnx(7-10, 11-12, 13-17, 18+)reduceSumSquareInput 'axes' if present should be a constant
Reluai.onnx(7-12, 13, 14+)relu
Reshapeai.onnx(7-12, 13, 14-18, 19-20, 21+)reshapeInput 'shape' should be a constant, 0 dimension value in 'shape' is not supported
Resizeai.onnx(11-12, 13-17, 18, 19+)resample2dOnly supports 4-D input, antialias == 0, exclude_outside == 0, keep_aspect_ratio_policy == 'stretch', 'linear' and 'nearest' modes, input 'scales' and 'sizes' if present must be a constant
RotaryEmbeddingai.onnx(23+), com.microsoft(1+)add, concat, gather, mul, reshape, slice, split
ScatterElementsai.onnx(11-12, 13-15, 16-17, 18+)scatterElementsOnly supports 'reduction' == 'none'
ScatterNDai.onnx(11-12, 13-15, 16-17, 18+)scatterNDOnly supports 'reduction' == 'none'
Shapeai.onnx(7-12, 13-14, 15-18, 19-20, 21+)slice
SimplifiedLayerNormalizationai.onnx(1+)pow, reduceMean, add, sqrt, div, mul
Sigmoidai.onnx(7-12, 13+)sigmoid
Signai.onnx(9-12, 13+)sign
SkipSimplifiedLayerNormalizationcom.microsoft(1+)pow, reduceMean, add, sqrt, div, mul
Softplusai.onnx(7+)softplus
Softsignai.onnx(7+)softsign
Sinai.onnx(7+)sin
Sliceai.onnx(7-9, 10, 11-12, 13+)slice, reverseInput 'starts', 'ends', 'axes', and 'steps' if present must be a constant
Softmaxai.onnx(7-10, 11-12, 13+)softmax
Splitai.onnx(7-10, 11-12, 13-17, 18+)splitInput 'split' if present should be a constant
Sqrtai.onnx(7-12, 13+)sqrt
Squeezeai.onnx(7-10, 11-12, 13-20, 21+)reshapeInput 'axes' if present should be a constant
Subai.onnx(7-12, 13, 14+)sub
Tanai.onnx(7+)tan
Tanhai.onnx(7-12, 13+)tanh
Tileai.onnx(7-12, 13+)tileInput 'repeats' should be a constant
Transposeai.onnx(7-12, 13-20, 21+)transpose
Triluai.onnx(14+)triangularInput 'k' (option 'diagonal' for WebNN) if present should be a constant
Unsqueezeai.onnx(7-10, 11-12, 13-20, 21+)reshape
Whereai.onnx(7-8, 9-15, 16+)where
Xorai.onnx(7+)logicalXor