ArmNN
 23.05
OptimizerOptionsOpaque Class Reference

#include <INetwork.hpp>

Public Member Functions

 OptimizerOptionsOpaque ()
 
 OptimizerOptionsOpaque (const OptimizerOptionsOpaque &other)
 
 ~OptimizerOptionsOpaque ()
 
 OptimizerOptionsOpaque (const OptimizerOptions &OptimizerStruct)
 
OptimizerOptionsOpaqueoperator= (OptimizerOptionsOpaque other)
 
 OptimizerOptionsOpaque (bool reduceFp32ToFp16, bool debug, bool reduceFp32ToBf16, bool importEnabled, ModelOptions modelOptions={}, bool exportEnabled=false, bool debugToFile=false)
 
 OptimizerOptionsOpaque (bool reduceFp32ToFp16, bool debug, bool reduceFp32ToBf16=false, ShapeInferenceMethod shapeInferenceMethod=armnn::ShapeInferenceMethod::ValidateOnly, bool importEnabled=false, ModelOptions modelOptions={}, bool exportEnabled=false, bool debugToFile=false, bool allowExpandedDims=false)
 
const std::string ToString () const
 
bool GetProfilingEnabled () const
 
bool GetImportEnabled () const
 
bool GetExportEnabled () const
 
bool GetReduceFp32ToFp16 () const
 
bool GetReduceFp32ToBf16 () const
 
bool GetDebugEnabled () const
 
bool GetDebugToFileEnabled () const
 
bool GetAllowExpandedDims () const
 
armnn::ModelOptions GetModelOptions () const
 
armnn::ShapeInferenceMethod GetShapeInferenceMethod () const
 
void SetImportEnabled (bool ImportState)
 
void SetExportEnabled (bool ExportState)
 
void SetProfilingEnabled (bool ProfilingState)
 
void SetDebugEnabled (bool DebugState)
 
void SetDebugToFileEnabled (bool DebugFileState)
 
void SetReduceFp32ToFp16 (bool ReduceFp32ToFp16State)
 
void SetShapeInferenceMethod (armnn::ShapeInferenceMethod ShapeInferenceMethodType)
 
void AddModelOption (armnn::BackendOptions)
 
void SetAllowExpandedDims (bool ExpandedDimsAllowed)
 

Detailed Description

Examples
CustomMemoryAllocatorSample.cpp.

Definition at line 260 of file INetwork.hpp.

Constructor & Destructor Documentation

◆ OptimizerOptionsOpaque() [1/5]

Definition at line 48 of file Network.cpp.

49  : p_OptimizerOptionsImpl(std::make_unique<OptimizerOptionsOpaqueImpl>())
50 {
51 }

◆ OptimizerOptionsOpaque() [2/5]

Definition at line 53 of file Network.cpp.

54  : p_OptimizerOptionsImpl(std::make_unique<OptimizerOptionsOpaqueImpl>(*other.p_OptimizerOptionsImpl))
55 {
56 }

◆ ~OptimizerOptionsOpaque()

~OptimizerOptionsOpaque ( )
default

◆ OptimizerOptionsOpaque() [3/5]

OptimizerOptionsOpaque ( const OptimizerOptions OptimizerStruct)

Definition at line 80 of file Network.cpp.

81  : p_OptimizerOptionsImpl(std::make_unique<OptimizerOptionsOpaqueImpl>())
82 {
83  p_OptimizerOptionsImpl->m_ImportEnabled = OptimizerStruct.m_ImportEnabled;
84  p_OptimizerOptionsImpl->m_shapeInferenceMethod = OptimizerStruct.m_shapeInferenceMethod;
85  p_OptimizerOptionsImpl->m_ModelOptions = OptimizerStruct.m_ModelOptions;
86  p_OptimizerOptionsImpl->m_ProfilingEnabled = OptimizerStruct.m_ProfilingEnabled;
87  p_OptimizerOptionsImpl->m_DebugToFile = OptimizerStruct.m_DebugToFile;
88  p_OptimizerOptionsImpl->m_Debug = OptimizerStruct.m_Debug;
89  p_OptimizerOptionsImpl->m_ReduceFp32ToFp16 = OptimizerStruct.m_ReduceFp32ToFp16;
90  p_OptimizerOptionsImpl->m_ExportEnabled = OptimizerStruct.m_ExportEnabled;
91  p_OptimizerOptionsImpl->m_AllowExpandedDims = OptimizerStruct.m_AllowExpandedDims;
92  p_OptimizerOptionsImpl->m_ReduceFp32ToBf16 = OptimizerStruct.m_ReduceFp32ToBf16;
93 }

References OptimizerOptions::m_AllowExpandedDims, OptimizerOptions::m_Debug, OptimizerOptions::m_DebugToFile, OptimizerOptions::m_ExportEnabled, OptimizerOptions::m_ImportEnabled, OptimizerOptions::m_ModelOptions, OptimizerOptions::m_ProfilingEnabled, OptimizerOptions::m_ReduceFp32ToBf16, OptimizerOptions::m_ReduceFp32ToFp16, and OptimizerOptions::m_shapeInferenceMethod.

◆ OptimizerOptionsOpaque() [4/5]

OptimizerOptionsOpaque ( bool  reduceFp32ToFp16,
bool  debug,
bool  reduceFp32ToBf16,
bool  importEnabled,
ModelOptions  modelOptions = {},
bool  exportEnabled = false,
bool  debugToFile = false 
)

Definition at line 60 of file Network.cpp.

63  : p_OptimizerOptionsImpl(std::make_unique<OptimizerOptionsOpaqueImpl>(reduceFp32ToFp16, debug, reduceFp32ToBf16,
64  importEnabled, modelOptions,
65  exportEnabled, debugToFile))
66 {
67 }

References armnn::debug.

◆ OptimizerOptionsOpaque() [5/5]

OptimizerOptionsOpaque ( bool  reduceFp32ToFp16,
bool  debug,
bool  reduceFp32ToBf16 = false,
ShapeInferenceMethod  shapeInferenceMethod = armnn::ShapeInferenceMethod::ValidateOnly,
bool  importEnabled = false,
ModelOptions  modelOptions = {},
bool  exportEnabled = false,
bool  debugToFile = false,
bool  allowExpandedDims = false 
)

Definition at line 69 of file Network.cpp.

73  : p_OptimizerOptionsImpl(std::make_unique<OptimizerOptionsOpaqueImpl>(reduceFp32ToFp16, debug, reduceFp32ToBf16,
74  shapeInferenceMethod, importEnabled,
75  modelOptions, exportEnabled,
76  debugToFile, allowExpandedDims))
77 {
78 }

References armnn::debug.

Member Function Documentation

◆ AddModelOption()

void AddModelOption ( armnn::BackendOptions  NewModelOption)

Definition at line 150 of file Network.cpp.

151 {
152  p_OptimizerOptionsImpl->m_ModelOptions.push_back(NewModelOption);
153 }

Referenced by ArmnnDriverImpl::PrepareArmnnModel(), and ArmnnDriverImpl::PrepareArmnnModelFromCache().

◆ GetAllowExpandedDims()

bool GetAllowExpandedDims ( ) const

Definition at line 190 of file Network.cpp.

191 {
192  return p_OptimizerOptionsImpl->m_AllowExpandedDims;
193 }

Referenced by OptimizerOptionsOpaque::operator=().

◆ GetDebugEnabled()

bool GetDebugEnabled ( ) const

Definition at line 180 of file Network.cpp.

181 {
182  return p_OptimizerOptionsImpl->m_Debug;
183 }

Referenced by OptimizerOptionsOpaque::operator=(), and armnn::Optimize().

◆ GetDebugToFileEnabled()

bool GetDebugToFileEnabled ( ) const

Definition at line 185 of file Network.cpp.

186 {
187  return p_OptimizerOptionsImpl->m_DebugToFile;
188 }

Referenced by OptimizerOptionsOpaque::operator=(), and armnn::Optimize().

◆ GetExportEnabled()

bool GetExportEnabled ( ) const

Definition at line 165 of file Network.cpp.

166 {
167  return p_OptimizerOptionsImpl->m_ExportEnabled;
168 };

Referenced by OptimizerOptionsOpaque::operator=(), and armnn::Optimize().

◆ GetImportEnabled()

bool GetImportEnabled ( ) const

Definition at line 160 of file Network.cpp.

161 {
162  return p_OptimizerOptionsImpl->m_ImportEnabled;
163 };

Referenced by OptimizerOptionsOpaque::operator=(), and armnn::Optimize().

◆ GetModelOptions()

armnn::ModelOptions GetModelOptions ( ) const

Definition at line 195 of file Network.cpp.

196 {
197  return p_OptimizerOptionsImpl->m_ModelOptions;
198 }

Referenced by OptimizerOptionsOpaque::operator=(), and armnn::Optimize().

◆ GetProfilingEnabled()

bool GetProfilingEnabled ( ) const

Definition at line 155 of file Network.cpp.

156 {
157  return p_OptimizerOptionsImpl->m_ProfilingEnabled;
158 };

Referenced by OptimizerOptionsOpaque::operator=(), and armnn::Optimize().

◆ GetReduceFp32ToBf16()

bool GetReduceFp32ToBf16 ( ) const

Definition at line 175 of file Network.cpp.

176 {
177  return p_OptimizerOptionsImpl->m_ReduceFp32ToBf16;
178 }

Referenced by OptimizerOptionsOpaque::operator=(), and armnn::Optimize().

◆ GetReduceFp32ToFp16()

bool GetReduceFp32ToFp16 ( ) const

Definition at line 170 of file Network.cpp.

171 {
172  return p_OptimizerOptionsImpl->m_ReduceFp32ToFp16;
173 };

Referenced by OptimizerOptionsOpaque::operator=(), and armnn::Optimize().

◆ GetShapeInferenceMethod()

armnn::ShapeInferenceMethod GetShapeInferenceMethod ( ) const

Definition at line 200 of file Network.cpp.

201 {
202  return p_OptimizerOptionsImpl->m_shapeInferenceMethod;
203 }

Referenced by OptimizerOptionsOpaque::operator=(), and armnn::Optimize().

◆ operator=()

Definition at line 95 of file Network.cpp.

96 {
97  p_OptimizerOptionsImpl->m_ImportEnabled = other.GetImportEnabled();
98  p_OptimizerOptionsImpl->m_shapeInferenceMethod = other.GetShapeInferenceMethod();
99  p_OptimizerOptionsImpl->m_ModelOptions = other.GetModelOptions();
100  p_OptimizerOptionsImpl->m_ProfilingEnabled = other.GetProfilingEnabled();
101  p_OptimizerOptionsImpl->m_DebugToFile = other.GetDebugToFileEnabled();
102  p_OptimizerOptionsImpl->m_Debug = other.GetDebugEnabled();
103  p_OptimizerOptionsImpl->m_ReduceFp32ToFp16 = other.GetReduceFp32ToFp16();
104  p_OptimizerOptionsImpl->m_ExportEnabled = other.GetExportEnabled();
105  p_OptimizerOptionsImpl->m_AllowExpandedDims = other.GetAllowExpandedDims();
106  p_OptimizerOptionsImpl->m_ReduceFp32ToBf16 = other.GetReduceFp32ToBf16();
107  return *this;
108 }

References OptimizerOptionsOpaque::GetAllowExpandedDims(), OptimizerOptionsOpaque::GetDebugEnabled(), OptimizerOptionsOpaque::GetDebugToFileEnabled(), OptimizerOptionsOpaque::GetExportEnabled(), OptimizerOptionsOpaque::GetImportEnabled(), OptimizerOptionsOpaque::GetModelOptions(), OptimizerOptionsOpaque::GetProfilingEnabled(), OptimizerOptionsOpaque::GetReduceFp32ToBf16(), OptimizerOptionsOpaque::GetReduceFp32ToFp16(), and OptimizerOptionsOpaque::GetShapeInferenceMethod().

◆ SetAllowExpandedDims()

void SetAllowExpandedDims ( bool  ExpandedDimsAllowed)

Definition at line 145 of file Network.cpp.

146 {
147  p_OptimizerOptionsImpl->m_AllowExpandedDims = ExpandedDimsAllowed;
148 }

◆ SetDebugEnabled()

void SetDebugEnabled ( bool  DebugState)

Definition at line 125 of file Network.cpp.

126 {
127  p_OptimizerOptionsImpl->m_Debug = DebugState;
128 }

◆ SetDebugToFileEnabled()

void SetDebugToFileEnabled ( bool  DebugFileState)

Definition at line 130 of file Network.cpp.

131 {
132  p_OptimizerOptionsImpl->m_DebugToFile = DebugFileState;
133 }

◆ SetExportEnabled()

void SetExportEnabled ( bool  ExportState)

Definition at line 115 of file Network.cpp.

116 {
117  p_OptimizerOptionsImpl->m_ExportEnabled = ExportState;
118 }

◆ SetImportEnabled()

void SetImportEnabled ( bool  ImportState)
Examples
CustomMemoryAllocatorSample.cpp.

Definition at line 110 of file Network.cpp.

111 {
112  p_OptimizerOptionsImpl->m_ImportEnabled = ImportState;
113 }

◆ SetProfilingEnabled()

void SetProfilingEnabled ( bool  ProfilingState)

Definition at line 120 of file Network.cpp.

121 {
122  p_OptimizerOptionsImpl->m_ProfilingEnabled = ProfilingState;
123 }

Referenced by ArmnnDriverImpl::PrepareArmnnModel(), and ArmnnDriverImpl::PrepareArmnnModelFromCache().

◆ SetReduceFp32ToFp16()

void SetReduceFp32ToFp16 ( bool  ReduceFp32ToFp16State)

Definition at line 135 of file Network.cpp.

136 {
137  p_OptimizerOptionsImpl->m_ReduceFp32ToFp16 = ReduceFp32ToFp16State;
138 }

Referenced by ArmnnDriverImpl::PrepareArmnnModel(), and ArmnnDriverImpl::PrepareArmnnModelFromCache().

◆ SetShapeInferenceMethod()

void SetShapeInferenceMethod ( armnn::ShapeInferenceMethod  ShapeInferenceMethodType)

Definition at line 140 of file Network.cpp.

141 {
142  p_OptimizerOptionsImpl->m_shapeInferenceMethod = ShapeInferenceMethodType;
143 }

◆ ToString()

const std::string ToString ( ) const

Definition at line 205 of file Network.cpp.

206 {
207  std::stringstream stream;
208  stream << "OptimizerOptions: \n";
209  stream << "\tReduceFp32ToFp16: " << p_OptimizerOptionsImpl->m_ReduceFp32ToFp16 << "\n";
210  stream << "\tReduceFp32ToBf16: " << p_OptimizerOptionsImpl->m_ReduceFp32ToBf16 << "\n";
211  stream << "\tDebug: " << p_OptimizerOptionsImpl->m_Debug << "\n";
212  stream << "\tDebug to file: " << p_OptimizerOptionsImpl->m_DebugToFile << "\n";
213  stream << "\tShapeInferenceMethod: " <<
214  (p_OptimizerOptionsImpl->m_shapeInferenceMethod == ShapeInferenceMethod::ValidateOnly ?
215  "ValidateOnly" : "InferAndValidate") << "\n";
216  stream << "\tImportEnabled: " << p_OptimizerOptionsImpl->m_ImportEnabled << "\n";
217  stream << "\tExportEnabled: " << p_OptimizerOptionsImpl->m_ExportEnabled << "\n";
218  stream << "\tProfilingEnabled: " << p_OptimizerOptionsImpl->m_ProfilingEnabled << "\n";
219  stream << "\tAllowExpandedDims: " << p_OptimizerOptionsImpl->m_AllowExpandedDims << "\n";
220 
221  stream << "\tModelOptions: \n";
222  for (auto optionsGroup : p_OptimizerOptionsImpl->m_ModelOptions)
223  {
224  for (size_t i=0; i < optionsGroup.GetOptionCount(); i++)
225  {
226  const armnn::BackendOptions::BackendOption option = optionsGroup.GetOption(i);
227  stream << "\t\tBackend: " << optionsGroup.GetBackendId() << "\n"
228  << "\t\t\tOption: " << option.GetName() << "\n"
229  << "\t\t\tValue: " << std::string(option.GetValue().ToString()) << "\n";
230  }
231  }
232 
233  return stream.str();
234 }

References BackendOptions::BackendOption::GetName(), BackendOptions::BackendOption::GetValue(), BackendOptions::Var::ToString(), and armnn::ValidateOnly.

Referenced by armnn::Optimize().


The documentation for this class was generated from the following files:
armnn::BackendOptions::BackendOption::GetValue
Var GetValue() const
Definition: BackendOptions.hpp:252
armnn::ShapeInferenceMethod::ValidateOnly
@ ValidateOnly
Validate all output shapes.
armnn::BackendOptions::Var::ToString
std::string ToString()
Definition: BackendOptions.hpp:124
armnn::BackendOptions::BackendOption::GetName
std::string GetName() const
Definition: BackendOptions.hpp:251
armnn::BackendOptions::BackendOption
Definition: BackendOptions.hpp:215