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 | |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 25 | @section S5_onnx_parser ArmNN Onnx Parser |
| 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 | |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 43 | - Constant |
| 44 | - 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] | 45 | |
| 46 | - Clip |
| 47 | - See the ONNX [Clip documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Clip) for more information. |
| 48 | |
| 49 | - Flatten |
| 50 | - See the ONNX [Flatten documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Flatten) for more information. |
| 51 | |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 52 | - GlobalAveragePool |
| 53 | - 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] | 54 | |
| 55 | - LeakyRelu |
| 56 | - See the ONNX [LeakyRelu documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#LeakyRelu) for more information. |
| 57 | |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 58 | - MaxPool |
| 59 | - 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] | 60 | |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 61 | - Relu |
| 62 | - 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] | 63 | |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 64 | - Reshape |
| 65 | - See the ONNX [Reshape documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Reshape) for more information. |
| 66 | |
Ryan OShea | b23b999 | 2020-04-23 15:45:04 +0100 | [diff] [blame] | 67 | - Sigmoid |
| 68 | - See the ONNX [Sigmoid documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sigmoid) for more information. |
| 69 | |
| 70 | - Tanh |
| 71 | - See the ONNX [Tanh documentation](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Tanh) for more information. |
| 72 | |
| 73 | |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 74 | ### Partially supported |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 75 | |
| 76 | - Conv |
Jan Eilers | 1121c6b | 2021-02-19 09:38:03 +0000 | [diff] [blame] | 77 | - 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] | 78 | - BatchNormalization |
| 79 | - 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. |
| 80 | - MatMul |
| 81 | - The parser only supports constant weights in a fully connected layer. |
| 82 | |
| 83 | ## Tested networks |
| 84 | |
| 85 | Arm tested these operators with the following ONNX fp32 neural networks: |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 86 | - Mobilenet_v2. See the ONNX [MobileNet documentation](https://github.com/onnx/models/tree/master/vision/classification/mobilenet) for more information. |
| 87 | - 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] | 88 | |
| 89 | More machine learning operators will be supported in future releases. |
| 90 | <br/><br/><br/><br/> |
| 91 | |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 92 | |
| 93 | |
| 94 | |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 95 | @section S6_tf_lite_parser ArmNN Tf Lite Parser |
| 96 | |
| 97 | `armnnTfLiteParser` is a library for loading neural networks defined by TensorFlow Lite FlatBuffers files |
| 98 | into the Arm NN runtime. |
| 99 | |
| 100 | ## TensorFlow Lite operators that the Arm NN SDK supports |
| 101 | |
| 102 | This reference guide provides a list of TensorFlow Lite operators the Arm NN SDK currently supports. |
| 103 | |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 104 | ### Fully supported |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 105 | The Arm NN SDK TensorFlow Lite parser currently supports the following operators: |
| 106 | |
Matthew Sloyan | ed7fce4 | 2021-04-15 20:46:24 +0100 | [diff] [blame] | 107 | - ABS |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 108 | - ADD |
Matthew Sloyan | 28f177c | 2021-04-09 14:38:52 +0100 | [diff] [blame] | 109 | - ARG_MAX |
Matthew Sloyan | ed7fce4 | 2021-04-15 20:46:24 +0100 | [diff] [blame] | 110 | - ARG_MIN |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 111 | - AVERAGE_POOL_2D, Supported Fused Activation: RELU , RELU6 , TANH, NONE |
| 112 | - BATCH_TO_SPACE |
| 113 | - CONCATENATION, Supported Fused Activation: RELU , RELU6 , TANH, NONE |
| 114 | - CONV_2D, Supported Fused Activation: RELU , RELU6 , TANH, NONE |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 115 | - DEPTH_TO_SPACE |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 116 | - DEPTHWISE_CONV_2D, Supported Fused Activation: RELU , RELU6 , TANH, NONE |
James Ward | 590f3f7 | 2020-12-02 10:20:48 +0000 | [diff] [blame] | 117 | - DEQUANTIZE |
Darshan Patel | 42b3d7d | 2020-05-25 22:30:07 +0530 | [diff] [blame] | 118 | - DIV |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 119 | - ELU |
Bruno Goncalves | 2d0eb86 | 2021-07-11 14:10:15 -0300 | [diff] [blame] | 120 | - EQUAL |
Ryan OShea | eb1f9cf | 2020-05-21 17:07:40 +0100 | [diff] [blame] | 121 | - EXP |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 122 | - FULLY_CONNECTED, Supported Fused Activation: RELU , RELU6 , TANH, NONE |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 123 | - GATHER |
Bruno Goncalves | 2d0eb86 | 2021-07-11 14:10:15 -0300 | [diff] [blame] | 124 | - GREATER |
| 125 | - GREATER_EQUAL |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 126 | - HARD_SWISH |
| 127 | - LEAKY_RELU |
Bruno Goncalves | 2d0eb86 | 2021-07-11 14:10:15 -0300 | [diff] [blame] | 128 | - LESS |
| 129 | - LESS_EQUAL |
Matthew Sloyan | ed7fce4 | 2021-04-15 20:46:24 +0100 | [diff] [blame] | 130 | - LOGICAL_NOT |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 131 | - LOGISTIC |
| 132 | - L2_NORMALIZATION |
| 133 | - MAX_POOL_2D, Supported Fused Activation: RELU , RELU6 , TANH, NONE |
| 134 | - MAXIMUM |
| 135 | - MEAN |
| 136 | - MINIMUM |
Jan Eilers | 1121c6b | 2021-02-19 09:38:03 +0000 | [diff] [blame] | 137 | - MUL |
Darshan Patel | 83fcf98 | 2020-05-26 22:22:42 +0530 | [diff] [blame] | 138 | - NEG |
Bruno Goncalves | 2d0eb86 | 2021-07-11 14:10:15 -0300 | [diff] [blame] | 139 | - NOT_EQUAL |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 140 | - PACK |
| 141 | - PAD |
Narumol Prangnawarat | 4a4af11 | 2021-05-25 14:26:24 +0100 | [diff] [blame] | 142 | - PRELU |
James Ward | 590f3f7 | 2020-12-02 10:20:48 +0000 | [diff] [blame] | 143 | - QUANTIZE |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 144 | - RELU |
| 145 | - RELU6 |
Jan Eilers | 1121c6b | 2021-02-19 09:38:03 +0000 | [diff] [blame] | 146 | - REDUCE_MAX |
| 147 | - REDUCE_MIN |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 148 | - RESHAPE |
| 149 | - RESIZE_BILINEAR |
James Ward | 590f3f7 | 2020-12-02 10:20:48 +0000 | [diff] [blame] | 150 | - RESIZE_NEAREST_NEIGHBOR |
Matthew Sloyan | ed7fce4 | 2021-04-15 20:46:24 +0100 | [diff] [blame] | 151 | - RSQRT |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 152 | - SLICE |
| 153 | - SOFTMAX |
| 154 | - SPACE_TO_BATCH |
| 155 | - SPLIT |
Ryan OShea | 8670473 | 2020-05-26 11:41:04 +0100 | [diff] [blame] | 156 | - SPLIT_V |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 157 | - SQUEEZE |
| 158 | - STRIDED_SLICE |
| 159 | - SUB |
Jan Eilers | 1121c6b | 2021-02-19 09:38:03 +0000 | [diff] [blame] | 160 | - SUM |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 161 | - TANH |
| 162 | - TRANSPOSE |
| 163 | - TRANSPOSE_CONV |
| 164 | - UNPACK |
| 165 | |
Jan Eilers | 53ca2e5 | 2021-02-02 13:18:09 +0000 | [diff] [blame] | 166 | ### Custom Operator |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 167 | - TFLite_Detection_PostProcess |
| 168 | |
| 169 | ## Tested networks |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 170 | Arm tested these operators with the following TensorFlow Lite neural network: |
| 171 | - [Quantized MobileNet](http://download.tensorflow.org/models/mobilenet_v1_2018_02_22/mobilenet_v1_1.0_224_quant.tgz) |
| 172 | - [Quantized SSD MobileNet](http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_quantized_300x300_coco14_sync_2018_07_18.tar.gz) |
| 173 | - DeepSpeech v1 converted from [TensorFlow model](https://github.com/mozilla/DeepSpeech/releases/tag/v0.4.1) |
| 174 | - DeepSpeaker |
James Ward | 590f3f7 | 2020-12-02 10:20:48 +0000 | [diff] [blame] | 175 | - [DeepLab v3+](https://www.tensorflow.org/lite/models/segmentation/overview) |
| 176 | - FSRCNN |
| 177 | - EfficientNet-lite |
| 178 | - RDN converted from [TensorFlow model](https://github.com/hengchuan/RDN-TensorFlow) |
| 179 | - Quantized RDN (CpuRef) |
| 180 | - [Quantized Inception v3](http://download.tensorflow.org/models/tflite_11_05_08/inception_v3_quant.tgz) |
| 181 | - [Quantized Inception v4](http://download.tensorflow.org/models/inception_v4_299_quant_20181026.tgz) (CpuRef) |
| 182 | - Quantized ResNet v2 50 (CpuRef) |
| 183 | - Quantized Yolo v3 (CpuRef) |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 184 | |
| 185 | More machine learning operators will be supported in future releases. |
Ryan OShea | f3a4323 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 186 | |
| 187 | **/ |
| 188 | } |
Ryan OShea | 2bbfaa7 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 189 | |