blob: e60e3b8877436b55db47bd972239e32b8c73bbdf [file] [log] [blame]
Jan Eilers45274902020-10-15 18:34:43 +01001//
Teresa Charlin83b42912022-07-07 14:24:59 +01002// Copyright © 2022 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
Colm Donelan3cff15a2021-10-12 15:06:19 +010011#if defined(ARMNN_TFLITE_DELEGATE)
12#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,
23 TfliteInterpreter
24 };
25
Teresa Charlin83b42912022-07-07 14:24:59 +010026 bool m_AllowExpandedDims;
27 std::string m_CachedNetworkFilePath;
28 std::vector<armnn::BackendId> m_ComputeDevices;
29 bool m_Concurrent;
30 bool m_DequantizeOutput;
31 std::string m_DynamicBackendsPath;
32 bool m_EnableBf16TurboMode;
33 bool m_EnableFastMath = false;
34 bool m_EnableFp16TurboMode;
35 bool m_EnableLayerDetails = false;
36 bool m_EnableProfiling;
37 bool m_GenerateTensorData;
38 bool m_InferOutputShape = false;
39 bool m_EnableDelegate = false;
40 bool m_IsModelBinary;
41 std::vector<std::string> m_InputNames;
42 std::vector<std::string> m_InputTensorDataFilePaths;
43 std::vector<armnn::TensorShape> m_InputTensorShapes;
44 size_t m_Iterations;
45 std::string m_ModelPath;
46 unsigned int m_NumberOfThreads;
47 bool m_OutputDetailsToStdOut;
48 bool m_OutputDetailsOnlyToStdOut;
49 std::vector<std::string> m_OutputNames;
50 std::vector<std::string> m_OutputTensorFiles;
51 bool m_ParseUnsupported = false;
52 bool m_PrintIntermediate;
53 bool m_DontPrintOutputs;
54 bool m_QuantizeInput;
55 bool m_SaveCachedNetwork;
56 size_t m_SubgraphId;
57 double m_ThresholdTime;
58 int m_TuningLevel;
59 std::string m_TuningPath;
60 std::string m_MLGOTuningFilePath;
61 TfLiteExecutor m_TfLiteExecutor;
62 size_t m_ThreadPoolSize;
63 bool m_ImportInputsIfAligned;
64 bool m_ReuseBuffers;
65 std::string m_ComparisonFile;
66 std::vector<armnn::BackendId> m_ComparisonComputeDevices;
67 bool m_CompareWithTflite;
Jan Eilers45274902020-10-15 18:34:43 +010068 // Ensures that the parameters for ExecuteNetwork fit together
69 void ValidateParams();
Colm Donelan3cff15a2021-10-12 15:06:19 +010070
71#if defined(ARMNN_TFLITE_DELEGATE)
72 /// A utility method that populates a DelegateOptions object from this ExecuteNetworkParams.
73 armnnDelegate::DelegateOptions ToDelegateOptions() const;
74#endif
75
Jan Eilers45274902020-10-15 18:34:43 +010076};