2024-04-18 04:19:46 +00:00
## 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'.)
2024-06-19 08:45:31 +00:00
[WebNN API ](https://webmachinelearning.github.io/webnn ) provides two device types `cpu` and `gpu` to leverage different on-device accelerators. WebNN API implementation in Chromium uses TFLite XNNPack delegate backend for `cpu` device type and DirectML backend for `gpu` device type. [The op support status ](https://webmachinelearning.github.io/webnn-status/ ) behind these two backends is inconsistent.
2024-04-18 04:19:46 +00:00
| Operator | Opset | WebNN API | WebNN CPU | WebNN GPU | Comments |
|:------:|:------:|:------:|:-:|:-:|:------|
| Abs | ai.onnx(7-12, 13+) | abs | ✓ | ✓ | |
| Add | ai.onnx(7-12, 13, 14+) | add | ✓ | ✓ | |
2024-10-31 00:52:10 +00:00
| And | ai.onnx(7+) | logicalAnd | ✗ | ✓ | |
2024-07-26 00:07:01 +00:00
| ArgMax | ai.onnx(7-10, 11, 12, 13+) | argMax | ✓ | ✓ | |
| ArgMin | ai.onnx(7-10, 11, 12, 13+) | argMin | ✓ | ✓ | |
2024-04-18 04:19:46 +00:00
| AveragePool | ai.onnx(7-9, 10, 11, 12-18, 19+) | averagePool2d | ✓ | ✓ | Only supports 4-D input, 2-D 'kernel_shape', 'count_include_pad' value is 0 |
2024-06-25 02:04:23 +00:00
| BatchNormalization | ai.onnx(7-8, 9-13, 14, 15+) | batchNormalization | ✓ | ✓ | Only supports 'training_mode' value is 0, one output |
2024-06-19 08:51:19 +00:00
| Cast | ai.onnx(7-8, 9-12, 13-18, 19-20, 21+) | cast | ✓ | ✓ | WebNN CPU backend doesn't support casting to uint64 data type |
2024-04-18 04:19:46 +00:00
| Ceil | ai.onnx(7-12, 13+) | ceil | ✓ | ✓ | |
2024-06-06 15:22:18 +00:00
| Clip | ai.onnx(7-10, 11, 12, 13+) | clamp | ✓ | ✓ | WebNN CPU backend only supports 3 specific ranges: [0.0, infinity], [-1.0, 1.0], [0.0, 6.0] (Chromium issue: https://issues.chromium.org/issues/326156496) |
2024-04-18 04:19:46 +00:00
| Concat | ai.onnx(7-10, 11-12, 13+) | concat | ✓ | ✓ | |
2024-07-08 17:14:43 +00:00
| Conv | ai.onnx(7-10, 11+) | conv2d | ✓ | ✓ | Only supports 3-D or 4-D input and 'W' (weight) |
2024-07-31 00:46:08 +00:00
| ConvTranspose | ai.onnx(7-10, 11+) | convTranspose2d | ✓ | ✓ | Only supports 3-D or 4-D input and 'W' (weight). WebNN CPU backend only supports default dilations and group |
2024-06-19 08:45:31 +00:00
| Cos | ai.onnx(7+) | cos | ✓ | ✓ | |
2024-11-04 04:08:16 +00:00
| CumSum | ai.onnx(11-13, 14+) | cumulativeSum | ✓ | ✓ | |
2024-04-18 04:19:46 +00:00
| Div | ai.onnx(7-12, 13, 14+) | div | ✓ | ✓ | |
2024-09-17 15:18:47 +00:00
| DequantizeLinear | ai.onnx(10-12, 13-18, 19-20, 21-22, 23+) | dequantizeLinear | ✗ | ✓ | |
2024-08-02 23:25:04 +00:00
| Dropout | ai.onnx(7-9, 10-11, 12, 13-21, 22+) | identity | ✓ | ✓ | Only supports test mode |
2024-06-03 21:10:22 +00:00
| Elu | ai.onnx(7+) | elu | ✓ | ✓ | WebNN CPU backend only supports 'alpha' value is 1.0 |
2024-06-19 08:45:31 +00:00
| Equal | ai.onnx(7-10, 11-12, 13-18, 19+) | equal | ✓ | ✓ | |
2024-08-19 14:56:16 +00:00
| Erf | ai.onnx(7-9, 10-12, 13+) | erf | ✓ | ✓ | |
2024-06-19 08:45:31 +00:00
| Exp | ai.onnx(7-12, 13+) | exp | ✓ | ✓ | |
2024-06-24 16:52:12 +00:00
| Expand | ai.onnx(8-12, 13+) | expand | ✓ | ✓ | 'shape' input should be a constant |
2024-04-18 04:19:46 +00:00
| Flatten | ai.onnx(7-8, 9-10, 11-12, 13-20, 21+) | reshape | ✓ | ✓ | |
| Floor | ai.onnx(7-12, 13+) | floor | ✓ | ✓ | |
2024-06-19 08:45:31 +00:00
| Gather | ai.onnx(7-10, 11-12, 13+) | gather | ✓ | ✓ | |
2024-10-30 17:20:21 +00:00
| GatherElements | ai.onnx(11-12, 13+) | gatherElements | ✗ | ✓ | |
2024-10-28 22:04:45 +00:00
| GatherND | ai.onnx(11, 12, 13+) | gatherND | ✓ | ✓ | Only supports 'batch_dims' == 0 |
2024-06-24 16:52:12 +00:00
| Gelu | ai.onnx(20+) | gelu | ✓ | ✓ | |
2024-04-18 04:19:46 +00:00
| Gemm | ai.onnx(7-8, 9-10, 11-12, 13+) | gemm | ✓ | ✓ | Only supports 1-D 'C' input |
| GlobalAveragePool | ai.onnx(7+) | averagePool2d | ✓ | ✓ | Only supports 4-D input |
| GlobalMaxPool | ai.onnx(7+) | maxPool2d | ✓ | ✓ | Only supports 4-D input |
| GlobalLpPool| ai.onnx(7+) | l2Pool2d | ✗ | ✓ | Only supports 4-D input, 'p' value is 2 |
2024-06-19 08:45:31 +00:00
| Greater | ai.onnx(7-8, 9-12, 13+) | greater | ✓ | ✓ | |
| GreaterOrEqual | ai.onnx(12-15, 16+) | greaterOrEqual | ✓ | ✓ | |
2024-09-11 21:16:36 +00:00
| GRU | ai.onnx(7-13, 14-21, 22+) | gru | ✓ | ✓ | Only 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' |
2024-06-19 08:45:31 +00:00
| HardSigmoid | ai.onnx(7+) | hardSigmoid | ✓ | ✓ | |
2024-04-18 04:19:46 +00:00
| HardSwish | ai.onnx(14+) | hardSwish | ✓ | ✓ | |
2024-06-19 08:45:31 +00:00
| Identity | ai.onnx(7-13, 14-15, 16-18, 19-20, 21+) | identity | ✓ | ✓ | |
2024-06-25 02:04:23 +00:00
| InstanceNormalization | ai.onnx(7+) | instanceNormalization | ✓ | ✓ | |
| LayerNormalization | ai.onnx(7-16, 17+) | layerNormalization | ✓ | ✓ | |
2024-04-18 04:19:46 +00:00
| LeakyRelu | ai.onnx(7-15, 16+) | leakyRelu | ✓ | ✓ | |
2024-06-19 08:45:31 +00:00
| Less | ai.onnx(7-8, 9-12, 13+) | lesser | ✓ | ✓ | |
| LessOrEqual | ai.onnx(12-15, 16+) | lesserOrEqual | ✓ | ✓ | |
| Log | ai.onnx(7-12, 13+) | log | ✓ | ✓ | |
2024-04-18 04:19:46 +00:00
| LpPool | ai.onnx(7-10, 11-17, 18+) | l2Pool2d | ✗ | ✓ | Only supports 4-D input, 2-D 'kernel_shape', 'p' value is 2 |
2024-11-12 19:53:52 +00:00
| LRN | ai.onnx(7-12, 13+) | pad, averagePool2d, transpose, add, mul, pow, div | ✓ | ✓ | |
2024-09-27 21:23:08 +00:00
| LSTM | ai.onnx(7-13, 14-21, 22+) | lstm | ✓ | ✓ | Only 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' |
2024-06-06 15:22:41 +00:00
| MatMul | ai.onnx(7-8, 9-12, 13+) | matmul | ✓ | ✓ | |
2024-04-18 04:19:46 +00:00
| Max | ai.onnx(7, 8-11, 12, 13+) | max | ✓ | ✓ | |
| MaxPool | ai.onnx(7, 8-9, 10, 11, 12+) | maxPool2d | ✓ | ✓ | Only supports 4-D input, 2-D 'kernel_shape', 'storage_order' != 1, one output |
| Min | ai.onnx(7, 8-11, 12, 13+) | min | ✓ | ✓ | |
| Mul | ai.onnx(7-12, 13, 14+) | mul | ✓ | ✓ | |
| Neg | ai.onnx(7-12, 13+) | neg | ✓ | ✓ | |
2024-10-31 00:52:10 +00:00
| Not | ai.onnx(7+) | logicalNot | ✓ | ✓ | |
| Or | ai.onnx(7+) | logicalOr | ✗ | ✓ | |
2024-04-18 04:19:46 +00:00
| Pad | ai.onnx(7-10, 11-12, 13-17, 18, 19-20, 21+) | pad | ✓ | ✓ | modes == 'wrap' is not supported |
2024-06-19 08:45:31 +00:00
| Pow | ai.onnx(7-11, 12, 13-14, 15+) | pow | ✓ | ✓ | |
2024-06-20 18:04:01 +00:00
| PRelu | ai.onnx(7-8, 9-15, 16+) | prelu | ✓ | ✓ | WebNN CPU backend restricts the last dimension of input and slope to be same (Chromium issue: https://issues.chromium.org/issues/335517470) |
2024-09-17 15:18:47 +00:00
| QuantizeLinear | ai.onnx(10-12, 13-18, 19-20, 21-22, 23+) | quantizeLinear | ✗ | ✓ | |
2024-06-24 16:52:12 +00:00
| Reciprocal | ai.onnx(7-12, 13+) | reciprocal | ✓ | ✓ | |
2024-06-26 01:30:55 +00:00
| ReduceL1 | ai.onnx(7-10, 11-12, 13-17, 18+) | reduceL1 | ✓ | ✓ | Input 'axes' if present should be a constant |
| ReduceL2 | ai.onnx(7-10, 11-12, 13-17, 18+) | reduceL2 | ✓ | ✓ | Input 'axes' if present should be a constant |
| ReduceLogSum| ai.onnx(7-10, 11-12, 13-17, 18+) | reduceLogSum| ✓ | ✓ | Input 'axes' if present should be a constant |
| ReduceLogSumExp | ai.onnx(7-10, 11-12, 13-17, 18+) | reduceLogSumExp | ✓ | ✓ | Input 'axes' if present should be a constant |
2024-06-19 08:45:31 +00:00
| ReduceMax | ai.onnx(7-10, 11, 12, 13-17, 18-19, 20+) | reduceMax | ✓ | ✓ | Input 'axes' if present should be a constant |
2024-04-18 04:19:46 +00:00
| ReduceMean | ai.onnx(7-10, 11-12, 13-17, 18+) | reduceMean | ✓ | ✓ | Input 'axes' if present should be a constant |
2024-06-19 08:45:31 +00:00
| ReduceMin | ai.onnx(7-10, 11, 12, 13-17, 18-19, 20+) | reduceMin | ✓ | ✓ | Input 'axes' if present should be a constant |
| ReduceProd | ai.onnx(7-10, 11-12, 13-17, 18+) | reduceProduct | ✓ | ✓ | Input 'axes' if present should be a constant |
| ReduceSum | ai.onnx(7-10, 11-12, 13+) | reduceSum | ✓ | ✓ | Input 'axes' if present should be a constant |
2024-06-26 01:30:55 +00:00
| ReduceSumSquare | ai.onnx(7-10, 11-12, 13-17, 18+) | reduceSumSquare | ✓ | ✓ | Input 'axes' if present should be a constant |
2024-04-18 04:19:46 +00:00
| Relu | ai.onnx(7-12, 13, 14+) | relu | ✓ | ✓ | |
| Reshape | ai.onnx(7-12, 13, 14-18, 19-20, 21+) | reshape | ✓ | ✓ | Input 'shape' should be a constant, 0 dimension value in 'shape' is not supported |
2024-10-23 03:26:34 +00:00
| Resize | ai.onnx(11-12, 13-17, 18, 19+) | resample2d | ✓ | ✓ | Only supports 4-D input, antialias == 0, coordinate_transformation_mode == 'half_pixel', exclude_outside == 0, keep_aspect_ratio_policy == 'stretch', 'linear' and 'nearest' modes, input 'scales' and 'sizes' if present must be a constant |
2024-10-30 17:20:21 +00:00
| ScatterElements | ai.onnx(11-12, 13-15, 16-17, 18+) | scatterElements | ✗ | ✓ | Only supports 'reduction' == 'none' |
2024-10-28 22:04:45 +00:00
| ScatterND | ai.onnx(11-12, 13-15, 16-17, 18+) | scatterND | ✗ | ✓ | Only supports 'reduction' == 'none' |
2024-04-18 04:19:46 +00:00
| Shape | ai.onnx(7-12, 13-14, 15-18, 19-20, 21+) | slice | ✓ | ✓ | |
2024-11-04 20:25:11 +00:00
| SimplifiedLayerNormalization | ai.onnx(1+) | pow + reduceMean + add + sqrt + div + mul | ✓ | ✓ | |
2024-04-18 04:19:46 +00:00
| Sigmoid | ai.onnx(7-12, 13+) | sigmoid | ✓ | ✓ | |
2024-11-04 04:08:16 +00:00
| Sign | ai.onnx(9-12, 13+) | sign | ✓ | ✓ | |
2024-06-19 08:45:31 +00:00
| Softplus | ai.onnx(7+) | softplus | ✓ | ✓ | |
2024-06-24 16:52:12 +00:00
| Softsign | ai.onnx(7+) | softsign | ✓ | ✓ | |
2024-06-19 08:45:31 +00:00
| Sin | ai.onnx(7+) | sin | ✓ | ✓ | |
2024-11-10 02:20:52 +00:00
| Slice | ai.onnx(7-9, 10, 11-12, 13+) | slice | ✓ | ✓ | Input 'starts', 'ends', 'axes', and 'steps' if present must be a constant, only supports 'steps' value >= 1 |
2024-06-11 15:27:14 +00:00
| Softmax | ai.onnx(7-10, 11-12, 13+) | softmax | ✓ | ✓ | |
2024-06-06 15:22:41 +00:00
| Split | ai.onnx(7-10, 11-12, 13-17, 18+) | split | ✓ | ✓ | Input 'split' if present should be a constant |
2024-04-18 04:19:46 +00:00
| Sqrt | ai.onnx(7-12, 13+) | sqrt | ✓ | ✓ | |
| Squeeze | ai.onnx(7-10, 11-12, 13-20, 21+) | reshape | ✓ | ✓ | Input 'axes' if present should be a constant |
| Sub | ai.onnx(7-12, 13, 14+) | sub | ✓ | ✓ | |
2024-06-19 08:45:31 +00:00
| Tan | ai.onnx(7+) | tan | ✓ | ✓ | |
2024-04-18 04:19:46 +00:00
| Tanh | ai.onnx(7-12, 13+) | tanh | ✓ | ✓ | |
2024-10-05 07:56:55 +00:00
| Tile | ai.onnx(7-12, 13+) | tile | ✗ | ✓ | Input 'repeats' should be a constant |
2024-04-18 04:19:46 +00:00
| Transpose | ai.onnx(7-12, 13-20, 21+) | transpose | ✓ | ✓ | |
2024-08-19 14:56:16 +00:00
| Trilu | ai.onnx(14+) | triangular | ✓ | ✓ | Input 'k' (option 'diagonal' for WebNN) if present should be a constant |
2024-04-18 04:19:46 +00:00
| Unsqueeze | ai.onnx(7-10, 11-12, 13-20, 21+) | reshape | ✓ | ✓ | |
2024-06-19 08:45:31 +00:00
| Where | ai.onnx(7-8, 9-15, 16+) | where | ✓ | ✓ | |
2024-10-31 00:52:10 +00:00
| Xor | ai.onnx(7+) | logicalXor | ✗ | ✓ | |