Jan Eilers | 4527490 | 2020-10-15 18:34:43 +0100 | [diff] [blame] | 1 | // |
Colm Donelan | 00fe393 | 2023-08-16 21:57:54 +0100 | [diff] [blame] | 2 | // Copyright © 2022, 2024 Arm Ltd and Contributors. All rights reserved. |
Jan Eilers | 4527490 | 2020-10-15 18:34:43 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include <armnn/BackendId.hpp> |
| 9 | #include <armnn/Tensor.hpp> |
| 10 | |
Colm Donelan | 3cff15a | 2021-10-12 15:06:19 +0100 | [diff] [blame] | 11 | #if defined(ARMNN_TFLITE_DELEGATE) |
| 12 | #include <DelegateOptions.hpp> |
| 13 | #endif |
| 14 | |
Jan Eilers | 4527490 | 2020-10-15 18:34:43 +0100 | [diff] [blame] | 15 | /// Holds all parameters necessary to execute a network |
| 16 | /// Check ExecuteNetworkProgramOptions.cpp for a description of each parameter |
| 17 | struct ExecuteNetworkParams |
| 18 | { |
Finn Williams | f806c4d | 2021-02-22 15:13:12 +0000 | [diff] [blame] | 19 | enum class TfLiteExecutor |
| 20 | { |
| 21 | ArmNNTfLiteParser, |
| 22 | ArmNNTfLiteDelegate, |
Narumol Prangnawarat | 46e574e | 2023-05-05 16:39:05 +0100 | [diff] [blame] | 23 | TfliteInterpreter, |
| 24 | ArmNNTfLiteOpaqueDelegate, |
Finn Williams | f806c4d | 2021-02-22 15:13:12 +0000 | [diff] [blame] | 25 | }; |
| 26 | |
Teresa Charlin | 83b4291 | 2022-07-07 14:24:59 +0100 | [diff] [blame] | 27 | bool m_AllowExpandedDims; |
| 28 | std::string m_CachedNetworkFilePath; |
| 29 | std::vector<armnn::BackendId> m_ComputeDevices; |
| 30 | bool m_Concurrent; |
| 31 | bool m_DequantizeOutput; |
| 32 | std::string m_DynamicBackendsPath; |
| 33 | bool m_EnableBf16TurboMode; |
| 34 | bool m_EnableFastMath = false; |
| 35 | bool m_EnableFp16TurboMode; |
| 36 | bool m_EnableLayerDetails = false; |
| 37 | bool m_EnableProfiling; |
| 38 | bool m_GenerateTensorData; |
| 39 | bool m_InferOutputShape = false; |
| 40 | bool m_EnableDelegate = false; |
| 41 | bool m_IsModelBinary; |
| 42 | std::vector<std::string> m_InputNames; |
| 43 | std::vector<std::string> m_InputTensorDataFilePaths; |
| 44 | std::vector<armnn::TensorShape> m_InputTensorShapes; |
| 45 | size_t m_Iterations; |
| 46 | std::string m_ModelPath; |
| 47 | unsigned int m_NumberOfThreads; |
| 48 | bool m_OutputDetailsToStdOut; |
| 49 | bool m_OutputDetailsOnlyToStdOut; |
| 50 | std::vector<std::string> m_OutputNames; |
| 51 | std::vector<std::string> m_OutputTensorFiles; |
| 52 | bool m_ParseUnsupported = false; |
| 53 | bool m_PrintIntermediate; |
Keith Davis | 15f9c68 | 2022-10-14 15:50:33 +0100 | [diff] [blame] | 54 | bool m_PrintIntermediateOutputsToFile; |
Teresa Charlin | 83b4291 | 2022-07-07 14:24:59 +0100 | [diff] [blame] | 55 | bool m_DontPrintOutputs; |
| 56 | bool m_QuantizeInput; |
| 57 | bool m_SaveCachedNetwork; |
| 58 | size_t m_SubgraphId; |
| 59 | double m_ThresholdTime; |
| 60 | int m_TuningLevel; |
| 61 | std::string m_TuningPath; |
| 62 | std::string m_MLGOTuningFilePath; |
| 63 | TfLiteExecutor m_TfLiteExecutor; |
| 64 | size_t m_ThreadPoolSize; |
| 65 | bool m_ImportInputsIfAligned; |
| 66 | bool m_ReuseBuffers; |
| 67 | std::string m_ComparisonFile; |
| 68 | std::vector<armnn::BackendId> m_ComparisonComputeDevices; |
| 69 | bool m_CompareWithTflite; |
Colm Donelan | 00fe393 | 2023-08-16 21:57:54 +0100 | [diff] [blame] | 70 | bool m_SerializeToArmNN; |
Jan Eilers | 4527490 | 2020-10-15 18:34:43 +0100 | [diff] [blame] | 71 | // Ensures that the parameters for ExecuteNetwork fit together |
| 72 | void ValidateParams(); |
Colm Donelan | 3cff15a | 2021-10-12 15:06:19 +0100 | [diff] [blame] | 73 | |
| 74 | #if defined(ARMNN_TFLITE_DELEGATE) |
| 75 | /// A utility method that populates a DelegateOptions object from this ExecuteNetworkParams. |
| 76 | armnnDelegate::DelegateOptions ToDelegateOptions() const; |
| 77 | #endif |
| 78 | |
Jan Eilers | 4527490 | 2020-10-15 18:34:43 +0100 | [diff] [blame] | 79 | }; |