• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include <armnn/BackendId.hpp>
9 #include <armnn/Tensor.hpp>
10 
11 #if defined(ARMNN_TFLITE_DELEGATE)
12 #include <DelegateOptions.hpp>
13 #endif
14 
15 /// Holds all parameters necessary to execute a network
16 /// Check ExecuteNetworkProgramOptions.cpp for a description of each parameter
17 struct ExecuteNetworkParams
18 {
19     enum class TfLiteExecutor
20     {
21         ArmNNTfLiteParser,
22         ArmNNTfLiteDelegate,
23         TfliteInterpreter
24     };
25 
26     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_PrintIntermediateOutputsToFile;
54     bool                              m_DontPrintOutputs;
55     bool                              m_QuantizeInput;
56     bool                              m_SaveCachedNetwork;
57     size_t                            m_SubgraphId;
58     double                            m_ThresholdTime;
59     int                               m_TuningLevel;
60     std::string                       m_TuningPath;
61     std::string                       m_MLGOTuningFilePath;
62     TfLiteExecutor                    m_TfLiteExecutor;
63     size_t                            m_ThreadPoolSize;
64     bool                              m_ImportInputsIfAligned;
65     bool                              m_ReuseBuffers;
66     std::string                       m_ComparisonFile;
67     std::vector<armnn::BackendId>     m_ComparisonComputeDevices;
68     bool                              m_CompareWithTflite;
69     // Ensures that the parameters for ExecuteNetwork fit together
70     void ValidateParams();
71 
72 #if defined(ARMNN_TFLITE_DELEGATE)
73     /// A utility method that populates a DelegateOptions object from this ExecuteNetworkParams.
74     armnnDelegate::DelegateOptions ToDelegateOptions() const;
75 #endif
76 
77 };
78