blob: 5ef2b6ea7cdbcce38cf76f51637aae7bae02edb2 [file] [log] [blame]
Jan Eilers45274902020-10-15 18:34:43 +01001//
Nikhil Raj Armf4ccb1f2022-07-05 09:29:18 +00002// Copyright © 2020 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{
Nikhil Raj Armf4ccb1f2022-07-05 09:29:18 +000019 using TensorShapePtr = std::unique_ptr<armnn::TensorShape>;
20
Finn Williamsf806c4d2021-02-22 15:13:12 +000021 enum class TfLiteExecutor
22 {
23 ArmNNTfLiteParser,
24 ArmNNTfLiteDelegate,
25 TfliteInterpreter
26 };
27
Nikhil Raj Armf4ccb1f2022-07-05 09:29:18 +000028 bool m_AllowExpandedDims;
29 std::string m_CachedNetworkFilePath;
30 std::vector<armnn::BackendId> m_ComputeDevices;
31 bool m_Concurrent;
32 bool m_DequantizeOutput;
33 std::string m_DynamicBackendsPath;
34 bool m_EnableBf16TurboMode;
35 bool m_EnableFastMath = false;
36 bool m_EnableFp16TurboMode;
37 bool m_EnableLayerDetails = false;
38 bool m_EnableProfiling;
39 bool m_GenerateTensorData;
40 bool m_InferOutputShape = false;
41 bool m_EnableDelegate = false;
42 std::vector<std::string> m_InputNames;
43 std::vector<std::string> m_InputTensorDataFilePaths;
44 std::vector<TensorShapePtr> m_InputTensorShapes;
45 std::vector<std::string> m_InputTypes;
46 bool m_IsModelBinary;
47 size_t m_Iterations;
48 std::string m_ModelFormat;
49 std::string m_ModelPath;
50 unsigned int m_NumberOfThreads;
51 bool m_OutputDetailsToStdOut;
52 bool m_OutputDetailsOnlyToStdOut;
53 std::vector<std::string> m_OutputNames;
54 std::vector<std::string> m_OutputTensorFiles;
55 std::vector<std::string> m_OutputTypes;
56 bool m_ParseUnsupported = false;
57 bool m_PrintIntermediate;
58 bool m_DontPrintOutputs;
59 bool m_QuantizeInput;
60 bool m_SaveCachedNetwork;
61 size_t m_SimultaneousIterations;
62 size_t m_SubgraphId;
63 double m_ThresholdTime;
64 int m_TuningLevel;
65 std::string m_TuningPath;
66 std::string m_MLGOTuningFilePath;
67 TfLiteExecutor m_TfLiteExecutor;
68 size_t m_ThreadPoolSize;
69 bool m_ImportInputsIfAligned;
70 bool m_ReuseBuffers;
Jan Eilers45274902020-10-15 18:34:43 +010071
72 // Ensures that the parameters for ExecuteNetwork fit together
73 void ValidateParams();
Colm Donelan3cff15a2021-10-12 15:06:19 +010074
75#if defined(ARMNN_TFLITE_DELEGATE)
76 /// A utility method that populates a DelegateOptions object from this ExecuteNetworkParams.
77 armnnDelegate::DelegateOptions ToDelegateOptions() const;
78#endif
79
Jan Eilers45274902020-10-15 18:34:43 +010080};