Jan Eilers | 31a7c89 | 2021-01-29 14:18:13 +0000 | [diff] [blame] | 1 | /// Copyright (c) 2021 ARM Limited and Contributors. All rights reserved. |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 2 | /// |
| 3 | /// SPDX-License-Identifier: MIT |
| 4 | /// |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 5 | |
| 6 | namespace armnn |
| 7 | { |
| 8 | /** |
| 9 | @page parsers Parsers |
| 10 | |
| 11 | @tableofcontents |
Jan Eilers | b657819 | 2021-01-28 09:13:24 +0000 | [diff] [blame] | 12 | Execute models from different machine learning platforms efficiently with our parsers. Simply choose a parser according |
Kevin May | eb03e0f | 2021-04-28 16:16:22 +0100 | [diff] [blame] | 13 | to the model you want to run e.g. If you've got a model in onnx format (<model_name>.onnx) use our onnx-parser. |
Jan Eilers | b657819 | 2021-01-28 09:13:24 +0000 | [diff] [blame] | 14 | |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 15 | If you would like to run a Tensorflow Lite (TfLite) model you probably also want to take a look at our @ref delegate. |
Jan Eilers | 31a7c89 | 2021-01-29 14:18:13 +0000 | [diff] [blame] | 16 | |
| 17 | All parsers are written in C++ but it is also possible to use them in python. For more information on our python |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 18 | bindings take a look into the @ref md_python_pyarmnn_README section. |
Jan Eilers | 31a7c89 | 2021-01-29 14:18:13 +0000 | [diff] [blame] | 19 | |
Kevin May | eb03e0f | 2021-04-28 16:16:22 +0100 | [diff] [blame] | 20 | <br/><br/> |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 21 | |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 22 | |
| 23 | |
| 24 | |
Jan Eilers | 3309c33 | 2021-08-17 13:50:08 +0100 | [diff] [blame] | 25 | @section S5_onnx_parser Arm NN Onnx Parser |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 26 | |
| 27 | `armnnOnnxParser` is a library for loading neural networks defined in ONNX protobuf files into the Arm NN runtime. |
| 28 | |
| 29 | ## ONNX operators that the Arm NN SDK supports |
| 30 | |
| 31 | This reference guide provides a list of ONNX operators the Arm NN SDK currently supports. |
| 32 | |
| 33 | The Arm NN SDK ONNX parser currently only supports fp32 operators. |
| 34 | |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 35 | ### Fully supported |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 36 | |
| 37 | - Add |
| 38 | - See the ONNX [Add documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Add) for more information |
Ryan OShea | b23b999 | 2020-04-23 15:45:04 +0100 | [diff] [blame] | 39 | |
Ryan OShea | 2bbfaa7 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 40 | - AveragePool |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 41 | - See the ONNX [AveragePool documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#AveragePool) for more information. |
Ryan OShea | b23b999 | 2020-04-23 15:45:04 +0100 | [diff] [blame] | 42 | |
Narumol Prangnawarat | bc3bb62 | 2021-09-24 16:08:34 +0100 | [diff] [blame] | 43 | - Concat |
| 44 | - See the ONNX [Concat documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Concat) for more information. |
| 45 | |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 46 | - Constant |
| 47 | - See the ONNX [Constant documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Constant) for more information. |
Ryan OShea | b23b999 | 2020-04-23 15:45:04 +0100 | [diff] [blame] | 48 | |
| 49 | - Clip |
| 50 | - See the ONNX [Clip documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Clip) for more information. |
| 51 | |
| 52 | - Flatten |
| 53 | - See the ONNX [Flatten documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Flatten) for more information. |
| 54 | |
Narumol Prangnawarat | f10b15a | 2021-09-17 21:08:57 +0100 | [diff] [blame] | 55 | - Gather |
| 56 | - See the ONNX [Gather documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Gather) for more information. |
| 57 | |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 58 | - GlobalAveragePool |
| 59 | - See the ONNX [GlobalAveragePool documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#GlobalAveragePool) for more information. |
Ryan OShea | b23b999 | 2020-04-23 15:45:04 +0100 | [diff] [blame] | 60 | |
| 61 | - LeakyRelu |
| 62 | - See the ONNX [LeakyRelu documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#LeakyRelu) for more information. |
| 63 | |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 64 | - MaxPool |
| 65 | - See the ONNX [max_pool documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#MaxPool) for more information. |
Ryan OShea | b23b999 | 2020-04-23 15:45:04 +0100 | [diff] [blame] | 66 | |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 67 | - Relu |
| 68 | - See the ONNX [Relu documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Relu) for more information. |
Ryan OShea | b23b999 | 2020-04-23 15:45:04 +0100 | [diff] [blame] | 69 | |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 70 | - Reshape |
| 71 | - See the ONNX [Reshape documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Reshape) for more information. |
| 72 | |
Narumol Prangnawarat | f10b15a | 2021-09-17 21:08:57 +0100 | [diff] [blame] | 73 | - Shape |
| 74 | - See the ONNX [Shape documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Shape) for more information. |
| 75 | |
Ryan OShea | b23b999 | 2020-04-23 15:45:04 +0100 | [diff] [blame] | 76 | - Sigmoid |
| 77 | - See the ONNX [Sigmoid documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sigmoid) for more information. |
| 78 | |
| 79 | - Tanh |
| 80 | - See the ONNX [Tanh documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Tanh) for more information. |
| 81 | |
Narumol Prangnawarat | fe6aa2f | 2021-09-23 16:11:17 +0100 | [diff] [blame] | 82 | - Unsqueeze |
| 83 | - See the ONNX [Unsqueeze documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Unsqueeze) for more information. |
Ryan OShea | b23b999 | 2020-04-23 15:45:04 +0100 | [diff] [blame] | 84 | |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 85 | ### Partially supported |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 86 | |
| 87 | - Conv |
Jan Eilers | 1121c6b | 2021-02-19 09:38:03 +0000 | [diff] [blame] | 88 | - The parser only supports 2D convolutions with a group = 1 or group = #Nb_of_channel (depthwise convolution) |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 89 | - BatchNormalization |
| 90 | - The parser does not support training mode. See the ONNX [BatchNormalization documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#BatchNormalization) for more information. |
Narumol Prangnawarat | 1112b01 | 2021-09-30 12:10:50 +0100 | [diff] [blame] | 91 | - Gemm |
| 92 | - The parser only supports constant bias or non-constant bias where bias dimension = 1. See the ONNX [Gemm documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Gemm) for more information. |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 93 | - MatMul |
Teresa Charlin | d69cb90 | 2021-11-08 17:28:51 +0000 | [diff] [blame] | 94 | - The parser only supports constant weights in a fully connected layer. See the ONNX [MatMul documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#MatMul) for more information. |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 95 | |
| 96 | ## Tested networks |
| 97 | |
| 98 | Arm tested these operators with the following ONNX fp32 neural networks: |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 99 | - Mobilenet_v2. See the ONNX [MobileNet documentation](https://github.com/onnx/models/tree/master/vision/classification/mobilenet) for more information. |
| 100 | - Simple MNIST. This is no longer directly documented by ONNX. The model and test data may be downloaded [from the ONNX model zoo](https://onnxzoo.blob.core.windows.net/models/opset_8/mnist/mnist.tar.gz). |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 101 | |
| 102 | More machine learning operators will be supported in future releases. |
| 103 | <br/><br/><br/><br/> |
| 104 | |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 105 | |
| 106 | |
| 107 | |
Jan Eilers | 3309c33 | 2021-08-17 13:50:08 +0100 | [diff] [blame] | 108 | @section S6_tf_lite_parser Arm NN Tf Lite Parser |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 109 | |
| 110 | `armnnTfLiteParser` is a library for loading neural networks defined by TensorFlow Lite FlatBuffers files |
| 111 | into the Arm NN runtime. |
| 112 | |
| 113 | ## TensorFlow Lite operators that the Arm NN SDK supports |
| 114 | |
| 115 | This reference guide provides a list of TensorFlow Lite operators the Arm NN SDK currently supports. |
| 116 | |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 117 | ### Fully supported |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 118 | The Arm NN SDK TensorFlow Lite parser currently supports the following operators: |
| 119 | |
Matthew Sloyan | ed7fce4 | 2021-04-15 20:46:24 +0100 | [diff] [blame] | 120 | - ABS |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 121 | - ADD |
Matthew Sloyan | 28f177c | 2021-04-09 14:38:52 +0100 | [diff] [blame] | 122 | - ARG_MAX |
Matthew Sloyan | ed7fce4 | 2021-04-15 20:46:24 +0100 | [diff] [blame] | 123 | - ARG_MIN |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 124 | - AVERAGE_POOL_2D, Supported Fused Activation: RELU , RELU6 , TANH, NONE |
| 125 | - BATCH_TO_SPACE |
| 126 | - CONCATENATION, Supported Fused Activation: RELU , RELU6 , TANH, NONE |
| 127 | - CONV_2D, Supported Fused Activation: RELU , RELU6 , TANH, NONE |
Matthew Sloyan | eb5f810 | 2021-10-05 17:31:42 +0100 | [diff] [blame] | 128 | - CONV_3D, Supported Fused Activation: RELU , RELU6 , TANH, NONE |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 129 | - DEPTH_TO_SPACE |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 130 | - DEPTHWISE_CONV_2D, Supported Fused Activation: RELU , RELU6 , TANH, NONE |
James Ward | 590f3f7 | 2020-12-02 10:20:48 +0000 | [diff] [blame] | 131 | - DEQUANTIZE |
Darshan Patel | 42b3d7d | 2020-05-25 22:30:07 +0530 | [diff] [blame] | 132 | - DIV |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 133 | - ELU |
Bruno Goncalves | 2d0eb86 | 2021-07-11 14:10:15 -0300 | [diff] [blame] | 134 | - EQUAL |
Ryan OShea | eb1f9cf | 2020-05-21 17:07:40 +0100 | [diff] [blame] | 135 | - EXP |
Matthew Sloyan | e369dbd | 2021-08-19 12:05:44 +0100 | [diff] [blame] | 136 | - EXPAND_DIMS |
Teresa Charlin | cdbd40b | 2022-02-25 13:21:55 +0000 | [diff] [blame] | 137 | - FLOOR_DIV |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 138 | - FULLY_CONNECTED, Supported Fused Activation: RELU , RELU6 , TANH, NONE |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 139 | - GATHER |
Teresa Charlin | 91a53ea | 2022-04-25 15:47:29 +0100 | [diff] [blame] | 140 | - GATHER_ND |
Bruno Goncalves | 2d0eb86 | 2021-07-11 14:10:15 -0300 | [diff] [blame] | 141 | - GREATER |
| 142 | - GREATER_EQUAL |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 143 | - HARD_SWISH |
| 144 | - LEAKY_RELU |
Bruno Goncalves | 2d0eb86 | 2021-07-11 14:10:15 -0300 | [diff] [blame] | 145 | - LESS |
| 146 | - LESS_EQUAL |
Matthew Sloyan | ed7fce4 | 2021-04-15 20:46:24 +0100 | [diff] [blame] | 147 | - LOGICAL_NOT |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 148 | - LOGISTIC |
| 149 | - L2_NORMALIZATION |
| 150 | - MAX_POOL_2D, Supported Fused Activation: RELU , RELU6 , TANH, NONE |
| 151 | - MAXIMUM |
| 152 | - MEAN |
| 153 | - MINIMUM |
Matthew Sloyan | af3a4ef | 2021-10-22 15:48:12 +0100 | [diff] [blame] | 154 | - MIRROR_PAD |
Jan Eilers | 1121c6b | 2021-02-19 09:38:03 +0000 | [diff] [blame] | 155 | - MUL |
Darshan Patel | 83fcf98 | 2020-05-26 22:22:42 +0530 | [diff] [blame] | 156 | - NEG |
Bruno Goncalves | 2d0eb86 | 2021-07-11 14:10:15 -0300 | [diff] [blame] | 157 | - NOT_EQUAL |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 158 | - PACK |
| 159 | - PAD |
Mike Kelly | 0d77ae1 | 2022-01-07 17:42:27 +0000 | [diff] [blame] | 160 | - PADV2 |
Narumol Prangnawarat | 4a4af11 | 2021-05-25 14:26:24 +0100 | [diff] [blame] | 161 | - PRELU |
James Ward | 590f3f7 | 2020-12-02 10:20:48 +0000 | [diff] [blame] | 162 | - QUANTIZE |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 163 | - RELU |
| 164 | - RELU6 |
Jan Eilers | 1121c6b | 2021-02-19 09:38:03 +0000 | [diff] [blame] | 165 | - REDUCE_MAX |
| 166 | - REDUCE_MIN |
Teresa Charlin | d69cb90 | 2021-11-08 17:28:51 +0000 | [diff] [blame] | 167 | - REDUCE_PROD |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 168 | - RESHAPE |
| 169 | - RESIZE_BILINEAR |
James Ward | 590f3f7 | 2020-12-02 10:20:48 +0000 | [diff] [blame] | 170 | - RESIZE_NEAREST_NEIGHBOR |
Matthew Sloyan | ed7fce4 | 2021-04-15 20:46:24 +0100 | [diff] [blame] | 171 | - RSQRT |
Matthew Sloyan | e369dbd | 2021-08-19 12:05:44 +0100 | [diff] [blame] | 172 | - SHAPE |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 173 | - SLICE |
| 174 | - SOFTMAX |
| 175 | - SPACE_TO_BATCH |
| 176 | - SPLIT |
Ryan OShea | 8670473 | 2020-05-26 11:41:04 +0100 | [diff] [blame] | 177 | - SPLIT_V |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 178 | - SQUEEZE |
Teresa Charlin | f0fce5b | 2022-05-04 17:24:43 +0100 | [diff] [blame] | 179 | - SQRT |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 180 | - STRIDED_SLICE |
| 181 | - SUB |
Jan Eilers | 1121c6b | 2021-02-19 09:38:03 +0000 | [diff] [blame] | 182 | - SUM |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 183 | - TANH |
| 184 | - TRANSPOSE |
| 185 | - TRANSPOSE_CONV |
| 186 | - UNPACK |
| 187 | |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 188 | ### Custom Operator |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 189 | - TFLite_Detection_PostProcess |
| 190 | |
| 191 | ## Tested networks |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 192 | Arm tested these operators with the following TensorFlow Lite neural network: |
| 193 | - [Quantized MobileNet](http://download.tensorflow.org/models/mobilenet_v1_2018_02_22/mobilenet_v1_1.0_224_quant.tgz) |
| 194 | - [Quantized SSD MobileNet](http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_quantized_300x300_coco14_sync_2018_07_18.tar.gz) |
| 195 | - DeepSpeech v1 converted from [TensorFlow model](https://github.com/mozilla/DeepSpeech/releases/tag/v0.4.1) |
| 196 | - DeepSpeaker |
James Ward | 590f3f7 | 2020-12-02 10:20:48 +0000 | [diff] [blame] | 197 | - [DeepLab v3+](https://www.tensorflow.org/lite/models/segmentation/overview) |
| 198 | - FSRCNN |
| 199 | - EfficientNet-lite |
| 200 | - RDN converted from [TensorFlow model](https://github.com/hengchuan/RDN-TensorFlow) |
| 201 | - Quantized RDN (CpuRef) |
| 202 | - [Quantized Inception v3](http://download.tensorflow.org/models/tflite_11_05_08/inception_v3_quant.tgz) |
| 203 | - [Quantized Inception v4](http://download.tensorflow.org/models/inception_v4_299_quant_20181026.tgz) (CpuRef) |
| 204 | - Quantized ResNet v2 50 (CpuRef) |
| 205 | - Quantized Yolo v3 (CpuRef) |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 206 | |
| 207 | More machine learning operators will be supported in future releases. |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 208 | |
| 209 | **/ |
| 210 | } |
Ryan OShea | 2bbfaa7 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 211 | |