blob: 5eaae24b5e17d7bba8d5b718e555833e5bb51421 [file] [log] [blame]
Jan Eilers45274902020-10-15 18:34:43 +01001//
Colm Donelan00fe3932023-08-16 21:57:54 +01002// Copyright © 2022, 2024 Arm Ltd and Contributors. All rights reserved.
Jan Eilers45274902020-10-15 18:34:43 +01003// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
8#include <armnn/BackendId.hpp>
9#include <armnn/Tensor.hpp>
10
Matthew Bentham43c9e9a2024-06-17 15:19:28 +000011#if defined(ARMNN_TFLITE_DELEGATE)||defined(ARMNN_TFLITE_OPAQUE_DELEGATE)
Colm Donelan3cff15a2021-10-12 15:06:19 +010012#include <DelegateOptions.hpp>
13#endif
14
Jan Eilers45274902020-10-15 18:34:43 +010015/// Holds all parameters necessary to execute a network
16/// Check ExecuteNetworkProgramOptions.cpp for a description of each parameter
17struct ExecuteNetworkParams
18{
Finn Williamsf806c4d2021-02-22 15:13:12 +000019 enum class TfLiteExecutor
20 {
21 ArmNNTfLiteParser,
22 ArmNNTfLiteDelegate,
Narumol Prangnawarat46e574e2023-05-05 16:39:05 +010023 TfliteInterpreter,
24 ArmNNTfLiteOpaqueDelegate,
Finn Williamsf806c4d2021-02-22 15:13:12 +000025 };
26
Teresa Charlin83b42912022-07-07 14:24:59 +010027 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 Davis15f9c682022-10-14 15:50:33 +010054 bool m_PrintIntermediateOutputsToFile;
Teresa Charlin83b42912022-07-07 14:24:59 +010055 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 Donelan00fe3932023-08-16 21:57:54 +010070 bool m_SerializeToArmNN;
Jan Eilers45274902020-10-15 18:34:43 +010071 // Ensures that the parameters for ExecuteNetwork fit together
72 void ValidateParams();
Colm Donelan3cff15a2021-10-12 15:06:19 +010073
Matthew Bentham43c9e9a2024-06-17 15:19:28 +000074#if defined(ARMNN_TFLITE_DELEGATE)||defined(ARMNN_TFLITE_OPAQUE_DELEGATE)
Colm Donelan3cff15a2021-10-12 15:06:19 +010075 /// A utility method that populates a DelegateOptions object from this ExecuteNetworkParams.
76 armnnDelegate::DelegateOptions ToDelegateOptions() const;
77#endif
78
Jan Eilers45274902020-10-15 18:34:43 +010079};