ArmNN
 24.11
IOptimizedNetwork Class Reference

#include <INetwork.hpp>

Public Member Functions

Status PrintGraph ()
 
Status SerializeToDot (std::ostream &stream) const
 
arm::pipe::ProfilingGuid GetGuid () const
 
size_t GetNumInputs () const
 
size_t GetNumOutputs () const
 
void ExecuteStrategy (IStrategy &strategy) const
 
 IOptimizedNetwork (const IOptimizedNetwork &other, const ModelOptions &modelOptions)
 Creates a copy of the IOptimizedNetwork. More...
 
 IOptimizedNetwork (std::unique_ptr< Graph > graph)
 
 IOptimizedNetwork (std::unique_ptr< OptimizedNetworkImpl > impl)
 
 ~IOptimizedNetwork ()
 
const std::shared_ptr< IProfiler > & GetProfiler () const
 

Static Public Member Functions

static void Destroy (IOptimizedNetwork *network)
 

Protected Member Functions

 IOptimizedNetwork (std::unique_ptr< Graph > graph, const ModelOptions &modelOptions)
 

Protected Attributes

std::unique_ptr< OptimizedNetworkImplpOptimizedNetworkImpl
 

Friends

class LoadedNetwork
 
class experimental::AsyncNetworkImpl
 
class experimental::WorkingMemHandle
 
GraphGetGraphForTesting (IOptimizedNetwork *optNetPtr)
 
ModelOptionsGetModelOptionsForTesting (IOptimizedNetwork *optNetPtr)
 
IOptimizedNetworkPtr Optimize (const INetwork &inNetwork, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptionsOpaque &options, Optional< std::vector< std::string > & > messages)
 Create an optimized version of the network. More...
 
IOptimizedNetworkPtr Optimize (const Graph &inGraph, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptionsOpaque &options, Optional< std::vector< std::string > & > messages)
 Create an optimized version of the network. More...
 

Detailed Description

Definition at line 908 of file INetwork.hpp.

Constructor & Destructor Documentation

◆ IOptimizedNetwork() [1/4]

IOptimizedNetwork ( const IOptimizedNetwork other,
const ModelOptions modelOptions 
)

Creates a copy of the IOptimizedNetwork.

The IOptimizedNetwork will not be reoptimized, the provided ModelOptions will only be used when creating a LoadedNetwork.

Definition at line 692 of file Network.cpp.

693  : pOptimizedNetworkImpl(new OptimizedNetworkImpl(*other.pOptimizedNetworkImpl.get(), modelOptions)) {}

◆ IOptimizedNetwork() [2/4]

IOptimizedNetwork ( std::unique_ptr< Graph graph)

Definition at line 695 of file Network.cpp.

696  : pOptimizedNetworkImpl(new OptimizedNetworkImpl(std::move(graph))) {}

◆ IOptimizedNetwork() [3/4]

IOptimizedNetwork ( std::unique_ptr< OptimizedNetworkImpl impl)

Definition at line 698 of file Network.cpp.

699  : pOptimizedNetworkImpl(std::move(impl)) {}

◆ ~IOptimizedNetwork()

~IOptimizedNetwork ( )
default

◆ IOptimizedNetwork() [4/4]

IOptimizedNetwork ( std::unique_ptr< Graph graph,
const ModelOptions modelOptions 
)
protected

Definition at line 701 of file Network.cpp.

702  : pOptimizedNetworkImpl(new OptimizedNetworkImpl(std::move(graph), modelOptions)) {}

Member Function Documentation

◆ Destroy()

void Destroy ( IOptimizedNetwork network)
static

Definition at line 706 of file Network.cpp.

707 {
708  delete network;
709 }

◆ ExecuteStrategy()

void ExecuteStrategy ( IStrategy strategy) const

Definition at line 3269 of file Network.cpp.

3270 {
3271  pOptimizedNetworkImpl->ExecuteStrategy(strategy);
3272 }

References IOptimizedNetwork::pOptimizedNetworkImpl.

◆ GetGuid()

arm::pipe::ProfilingGuid GetGuid ( ) const

Definition at line 726 of file Network.cpp.

727 {
728  return pOptimizedNetworkImpl->GetGuid();
729 }

References IOptimizedNetwork::pOptimizedNetworkImpl.

◆ GetNumInputs()

size_t GetNumInputs ( ) const

Definition at line 731 of file Network.cpp.

732 {
733  return pOptimizedNetworkImpl->GetNumInputs();
734 }

References IOptimizedNetwork::pOptimizedNetworkImpl.

◆ GetNumOutputs()

size_t GetNumOutputs ( ) const

Definition at line 736 of file Network.cpp.

737 {
738  return pOptimizedNetworkImpl->GetNumOutputs();
739 }

References IOptimizedNetwork::pOptimizedNetworkImpl.

◆ GetProfiler()

const std::shared_ptr< IProfiler > & GetProfiler ( ) const

Definition at line 721 of file Network.cpp.

722 {
723  return pOptimizedNetworkImpl->GetGraph().GetProfiler();
724 }

References IOptimizedNetwork::pOptimizedNetworkImpl.

◆ PrintGraph()

Status PrintGraph ( )

Definition at line 711 of file Network.cpp.

712 {
713  return pOptimizedNetworkImpl->PrintGraph();
714 }

References IOptimizedNetwork::pOptimizedNetworkImpl.

◆ SerializeToDot()

Status SerializeToDot ( std::ostream &  stream) const

Definition at line 716 of file Network.cpp.

717 {
718  return pOptimizedNetworkImpl->SerializeToDot(stream);
719 }

References IOptimizedNetwork::pOptimizedNetworkImpl.

Referenced by armnn_driver::ExportNetworkGraphToDotFile().

Friends And Related Function Documentation

◆ experimental::AsyncNetworkImpl

friend class experimental::AsyncNetworkImpl
friend

Definition at line 935 of file INetwork.hpp.

◆ experimental::WorkingMemHandle

friend class experimental::WorkingMemHandle
friend

Definition at line 936 of file INetwork.hpp.

◆ GetGraphForTesting

Graph& GetGraphForTesting ( IOptimizedNetwork optNetPtr)
friend

Definition at line 49 of file TestUtils.cpp.

50 {
51  return optNet->pOptimizedNetworkImpl->GetGraph();
52 }

◆ GetModelOptionsForTesting

ModelOptions& GetModelOptionsForTesting ( IOptimizedNetwork optNetPtr)
friend

Definition at line 54 of file TestUtils.cpp.

55 {
56  return optNet->pOptimizedNetworkImpl->GetModelOptions();
57 }

◆ LoadedNetwork

friend class LoadedNetwork
friend

Definition at line 933 of file INetwork.hpp.

◆ Optimize [1/2]

IOptimizedNetworkPtr Optimize ( const Graph inGraph,
const std::vector< BackendId > &  backendPreferences,
const IDeviceSpec deviceSpec,
const OptimizerOptionsOpaque options,
Optional< std::vector< std::string > & >  messages = EmptyOptional() 
)
friend

Create an optimized version of the network.

Parameters
inGraphGraph to be optimized.
backendPreferencesThe choice of the backend ordered by user preferences.
deviceSpecDeviceSpec object as queried from the runtime. See IRuntime::GetDeviceSpec()
messagesIf there are failures or warnings a string describing same will be added to the vector
optionsOptimizerOptions object with optimizer configuration options
Returns
An IOptimizedNetworkPtr interface to the optimized network, throws an exception derived from armnn::Exception if process fails.

Definition at line 2015 of file Network.cpp.

2020 {
2021  ARMNN_LOG(debug) << options.ToString();
2022 
2023  // Enable profiling
2024  auto profiler = inGraph.GetProfiler();
2026  profiler->EnableProfiling(options.GetProfilingEnabled());
2027 
2029  if (backendPreferences.empty())
2030  {
2031  throw InvalidArgumentException("Invoked Optimize with no backends specified");
2032  }
2033 
2034  if (options.GetReduceFp32ToBf16())
2035  {
2036  throw InvalidArgumentException("BFloat16 optimization is currently ignored. In order to use Bf16 optimization "
2037  "Please use the FastMathEnabled backend option for CpuAcc or GpuAcc.");
2038  }
2039 
2040  if (options.GetReduceFp32ToFp16() && options.GetReduceFp32ToBf16())
2041  {
2042  throw InvalidArgumentException("BFloat16 and Float16 optimization cannot be enabled at the same time.");
2043  }
2044 
2045  // Ensure TensorInfo is set on all output slots of ConstantLayers in the graph
2046  inGraph.VerifyConstantLayerSetTensorInfo();
2047 
2048  std::unique_ptr<Graph> graph = std::make_unique<Graph>(inGraph);
2049 
2050  // We need to pass on the information about whether import and export is enabled to the LoadNetwork phase.
2051  // The mechanism to do that is to add model options to the optimized network.
2052  armnn::BackendOptions importExport("Global",
2053  {{"ImportEnabled", options.GetImportEnabled()},
2054  {"ExportEnabled", options.GetExportEnabled()}});
2055  ModelOptions optimizedOptions(options.GetModelOptions());
2056  optimizedOptions.push_back(importExport);
2057 
2058  auto optNet = IOptimizedNetworkPtr(new IOptimizedNetwork(std::move(graph), optimizedOptions),
2060 
2061  IOptimizedNetwork* optNetObjPtr = optNet.get();
2062 
2063  // Get the optimized graph
2064  Graph& optGraph = optNetObjPtr->pOptimizedNetworkImpl->GetGraph();
2065 
2066  if(options.GetShapeInferenceMethod() == ShapeInferenceMethod::InferAndValidate)
2067  {
2068  // Infer the tensor infos for all output slots. Throws an exception on failure
2069  optGraph.InferTensorInfos();
2070  }
2071 
2072  using namespace optimizations;
2073  // Substitute Max + Min with Bounded Relu before AddBroadcastReshapeLayer optimisation,
2074  // as Bounded ReLu needs the constants to be 1D size 1
2076 
2077  // Perform BroadcastToOptimizationLayer before AddBroadcastReshapeLayer optimisation
2079 
2081 
2082  if(options.GetShapeInferenceMethod() == ShapeInferenceMethod::ValidateOnly)
2083  {
2084  // Validate the tensor infos for all output slots. Throws an exception on failure
2085  optGraph.InferTensorInfos();
2086  }
2087 
2088  // Initialize backend settings
2089  BackendSettings backendSettings(backendPreferences, deviceSpec);
2090  auto availablePreferredBackends = backendSettings.GetAvailablePreferredBackends();
2091  if (availablePreferredBackends.empty())
2092  {
2093  std::stringstream failureMsg;
2094  failureMsg << "None of the preferred backends " << backendPreferences
2095  << " are supported. Current platform provides " << backendSettings.m_SupportedBackends;
2096  ReportError(failureMsg.str(), messages);
2097  throw InvalidArgumentException(failureMsg.str());
2098  }
2099 
2100  // Create a map to temporarily hold initialized backend objects
2101  TensorHandleFactoryRegistry tensorHandleFactoryRegistry;
2102  BackendsMap backends = CreateSupportedBackends(tensorHandleFactoryRegistry, backendSettings);
2103  bool hasFp16 = CheckFp16Support(backends, availablePreferredBackends);
2104 
2105  bool reduceFp32ToFp16 = options.GetReduceFp32ToFp16();
2106  // If fp16 is supported on the backend and fastmath has been enabled and the model is a TfLite converted Fp16
2107  // model: enable turbo mode optimizations
2108  if (hasFp16 && CheckFastMathSupport(availablePreferredBackends, optimizedOptions) && IsTfLiteTurboModel(optGraph))
2109  {
2111  reduceFp32ToFp16 = true;
2112  }
2113  else
2114  {
2116  }
2117 
2118  // Group Constant Layer optimizations together where possible.
2119  // This is important as:
2120  // FusePermuteIntoConstantLayer must happen before FoldPadIntoDepthwiseConvolution2d and
2121  // FuseBatchNormIntoDepthwiseConvolution2D.
2123  // Perform optimisation passes
2129  MovePermuteUp(),
2130  MoveTransposeUp(),
2131  PermuteAsReshape(),
2144 
2145  const std::vector<BackendId> mappedGpuBackends = BackendRegistryInstance().GetMappedGpuBackends();
2146 
2147  // All or nothing Gpu backends cannot be used as fallback
2148  for (auto backend : mappedGpuBackends)
2149  {
2150  if (std::count(backendPreferences.begin(), backendPreferences.end(), backend)
2151  && (backendPreferences[0] != backend) &&
2152  (backendPreferences[0] != armnn::BackendId("GpuAcc")))
2153  {
2154  std::stringstream failureMsg;
2155  failureMsg << backend << " backend cannot be specified as fallback.";
2156  ReportError(failureMsg.str(), messages);
2157  throw InvalidArgumentException(failureMsg.str());
2158  }
2159  }
2160 
2161  std::vector<BackendId> amendedBackendPreferences = backendPreferences;
2162  std::unordered_set<BackendId> supportedBackends = armnn::BackendRegistryInstance().GetBackendIds();
2163  if (amendedBackendPreferences[0] == armnn::BackendId("GpuAcc"))
2164  {
2165  // Add mapped Gpu backends if not already there and GpuAcc is first backend requested
2166  for (auto backend : mappedGpuBackends)
2167  {
2168  if (!std::count(amendedBackendPreferences.begin(), amendedBackendPreferences.end(), backend))
2169  {
2170  amendedBackendPreferences.insert(amendedBackendPreferences.begin(), backend);
2171  }
2172  }
2173  }
2174 
2175  if (reduceFp32ToFp16 && hasFp16)
2176  {
2177  ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "Optimizer_ReduceFp32ToFp16");
2180  }
2181  // Assign an available backend to each layer
2182  Graph::Iterator firstLayer = optGraph.begin();
2183  Graph::Iterator lastLayer = optGraph.end();
2184  OptimizationResult assignBackendsResult = AssignBackends(optNetObjPtr->pOptimizedNetworkImpl.get(),
2185  backendSettings,
2186  firstLayer,
2187  lastLayer,
2188  messages);
2189  if (assignBackendsResult.m_Error)
2190  {
2191  // Failed to assign a backend to each layer
2192  throw InvalidArgumentException("Failed to assign a backend to each layer");
2193  }
2194 
2197 
2198  // Apply the backend-specific optimizations
2199  OptimizationResult backendOptimizationResult = ApplyBackendOptimizations(optNetObjPtr->pOptimizedNetworkImpl.get(),
2200  backendSettings,
2201  backends,
2202  options.GetModelOptions(),
2203  messages);
2204  if (backendOptimizationResult.m_Error)
2205  {
2206  // Failed to apply the backend-specific optimizations
2207  throw InvalidArgumentException("Failed to apply the backend-specific optimizations");
2208  }
2209 
2210  // Convert constants
2211  {
2212  ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "Optimizer_ConvertConstants");
2215  }
2216 
2217  // This must occur after all topological changes to the graph and any redirection of variables
2218  // If the debug flag is set, then insert a DebugLayer after each layer
2219  // Doing this after applying the backend optimizations as they might have changed some layers
2220  if (options.GetDebugEnabled() && !options.GetDebugToFileEnabled())
2221  {
2223  }
2224  else if (options.GetDebugToFileEnabled())
2225  {
2226  // Setup the output file path
2227  try
2228  {
2229 #if !defined(ARMNN_DISABLE_FILESYSTEM)
2230  auto result = armnnUtils::Filesystem::CreateDirectory("/ArmNNIntermediateLayerOutputs");
2231  ARMNN_LOG(info) << "Intermediate tensors will be written to: " << result;
2232 #endif
2234  }
2235  catch (const armnn::RuntimeException& e)
2236  {
2237  // If we cannot create the output directory then we'll issue a warning and continue.
2238  ARMNN_LOG(warning) << "Unable to print intermediate layer outputs : " << e.what();
2239  }
2240  }
2241 
2242  // Calculate the compatibility strategies for tensor handles
2243  OptimizationResult strategyResult = SelectTensorHandleStrategy(optGraph,
2244  backends,
2245  tensorHandleFactoryRegistry,
2246  options.GetImportEnabled(),
2247  options.GetExportEnabled(),
2248  messages);
2249 
2250  if (strategyResult.m_Error)
2251  {
2252  // Failed to apply the backend-specific optimizations
2254  }
2255 
2256  // Based on the tensor handle strategy determined above, insert copy layers where required.
2257  {
2258  ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "Optimizer_AddCompatibilityLayers");
2259  optGraph.AddCompatibilityLayers(backends, tensorHandleFactoryRegistry);
2260  }
2261 
2262  return optNet;
2263 }

◆ Optimize [2/2]

IOptimizedNetworkPtr Optimize ( const INetwork inNetwork,
const std::vector< BackendId > &  backendPreferences,
const IDeviceSpec deviceSpec,
const OptimizerOptionsOpaque options = OptimizerOptionsOpaque(),
Optional< std::vector< std::string > & >  messages = EmptyOptional() 
)
friend

Create an optimized version of the network.

Parameters
networkINetwork description of the network to be optimized.
backendPreferencesThe choice of the backend ordered by user preferences.
deviceSpecDeviceSpec object as queried from the runtime. See IRuntime::GetDeviceSpec()
messagesIf there are failures or warnings a string describing same will be added to the vector
optionsOptimizerOptions object with optimizer configuration options
Returns
An IOptimizedNetworkPtr interface to the optimized network, throws an exception derived from armnn::Exception if process fails.

Definition at line 2279 of file Network.cpp.

2284 {
2285  return Optimize(inNetwork.pNetworkImpl->GetGraph(),
2286  backendPreferences,
2287  deviceSpec,
2288  options,
2289  messages);
2290 }

Member Data Documentation

◆ pOptimizedNetworkImpl


The documentation for this class was generated from the following files:
armnn::optimizations::InsertDebugToFileLayer
OptimizeForType< Layer, AddDebugToFileImpl > InsertDebugToFileLayer
Definition: AddDebug.hpp:54
armnn::IOptimizedNetworkPtr
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Definition: INetwork.hpp:340
armnn::ApplyBackendOptimizations
OptimizationResult ApplyBackendOptimizations(OptimizedNetworkImpl *optNetObjPtr, BackendSettings &backendSettings, BackendsMap &backends, const ModelOptions &modelOptions, Optional< std::vector< std::string > & > errMessages)
Definition: Network.cpp:1372
armnn::Compute::Undefined
@ Undefined
armnn::optimizations::InsertDebugLayer
OptimizeForType< Layer, AddDebugImpl > InsertDebugLayer
Definition: AddDebug.hpp:53
armnn::optimizations::FuseBatchNormIntoConvolution2DFloat32
OptimizeForExclusiveConnection< Convolution2dLayer, BatchNormalizationLayer, FuseBatchNorm< Convolution2dLayer, armnn::DataType::Float32 > > FuseBatchNormIntoConvolution2DFloat32
Definition: FuseBatchNorm.hpp:222
armnn::ProfilerManager::RegisterProfiler
void RegisterProfiler(IProfiler *profiler)
Definition: Profiling.cpp:609
armnn::optimizations::OptimizeInversePermutes
OptimizeForConnection< PermuteLayer, PermuteLayer, OptimizeInversePermutesImpl< PermuteLayer > > OptimizeInversePermutes
Definition: OptimizeInversePermutes.hpp:43
armnn::optimizations::TransposeAndBatchToSpaceAsDepthToSpace
OptimizeForConnection< TransposeLayer, BatchToSpaceNdLayer, PermuteAndBatchToSpaceAsDepthToSpaceImpl< TransposeLayer > > TransposeAndBatchToSpaceAsDepthToSpace
Definition: PermuteAndBatchToSpaceAsDepthToSpace.hpp:104
armnn::optimizations::FoldPadIntoPooling2d
OptimizeForExclusiveConnection< PadLayer, Pooling2dLayer, pad_fold::FoldPadIntoPooling2dImpl > FoldPadIntoPooling2d
Definition: FoldPadIntoLayer2d.hpp:283
armnn::optimizations::Fp32NetworkToFp16Converter
OptimizeForType< Layer, ConvertFp32NetworkToFp16Impl > Fp32NetworkToFp16Converter
Definition: ConvertFp32NetworkToFp16.hpp:87
armnn::optimizations::FoldPadIntoConvolution2d
OptimizeForExclusiveConnection< PadLayer, Convolution2dLayer, pad_fold::FoldPadIntoConvolution2dImpl > FoldPadIntoConvolution2d
Definition: FoldPadIntoLayer2d.hpp:277
armnn::optimizations::ConvertConstDequantisationLayersToConstLayers
OptimizeForConnection< ConstantLayer, DequantizeLayer, ConvertConstDequantisationLayersToConstLayersImpl > ConvertConstDequantisationLayersToConstLayers
Definition: ConvertConstDequantisationLayersToConstLayers.hpp:173
armnn::optimizations::MoveTransposeUp
OptimizeForConnection< Layer, TransposeLayer, MoveTransposeUpImpl > MoveTransposeUp
Definition: MoveTransposeUp.hpp:83
armnn::AssignBackends
OptimizationResult AssignBackends(OptimizedNetworkImpl *optNetObjPtr, BackendSettings &backendSettings, Graph::Iterator &firstLayer, Graph::Iterator &lastLayer, Optional< std::vector< std::string > & > errMessages)
Definition: Network.cpp:1211
armnn::optimizations::BroadcastToOptimizationLayer
OptimizeForType< BroadcastToLayer, DeleteBroadcastToImpl > BroadcastToOptimizationLayer
Definition: DeleteBroadcastTo.hpp:38
armnn::Graph::Iterator
LayerList::const_iterator Iterator
Definition: Graph.hpp:53
armnn::BackendRegistry::GetBackendIds
BackendIdSet GetBackendIds() const
Definition: BackendRegistry.cpp:75
armnn::optimizations::PermuteAsReshape
OptimizeForType< PermuteLayer, PermuteAsReshapeImpl > PermuteAsReshape
Definition: PermuteAsReshape.hpp:66
armnn::IsTfLiteTurboModel
bool IsTfLiteTurboModel(const Graph &optGraph)
Definition: Network.cpp:1973
armnn::optimizations::PermuteAndBatchToSpaceAsDepthToSpace
OptimizeForConnection< PermuteLayer, BatchToSpaceNdLayer, PermuteAndBatchToSpaceAsDepthToSpaceImpl< PermuteLayer > > PermuteAndBatchToSpaceAsDepthToSpace
Definition: PermuteAndBatchToSpaceAsDepthToSpace.hpp:102
armnn::SelectTensorHandleStrategy
OptimizationResult SelectTensorHandleStrategy(Graph &optGraph, BackendsMap &backends, TensorHandleFactoryRegistry &registry, bool importEnabled, bool exportEnabled, Optional< std::vector< std::string > & > errMessages)
Definition: Network.cpp:1873
armnn::optimizations::TurboConvertConstDequantisationLayersToConstLayers
OptimizeForConnection< ConstantLayer, DequantizeLayer, TurboConvertConstDequantisationLayersToConstLayersImpl > TurboConvertConstDequantisationLayersToConstLayers
Definition: TurboConvertConstDequantisationLayersToConstLayers.hpp:127
armnn::optimizations::MovePermuteUp
OptimizeForConnection< Layer, PermuteLayer, MovePermuteUpImpl > MovePermuteUp
Definition: MovePermuteUp.hpp:83
armnn::optimizations::OptimizeInverseConversionsFp16
OptimizeForConnection< ConvertFp16ToFp32Layer, ConvertFp32ToFp16Layer, OptimizeInverseConversionsImpl > OptimizeInverseConversionsFp16
Definition: OptimizeInverseConversions.hpp:42
armnn::Exception::what
virtual const char * what() const noexcept override
Definition: Exceptions.cpp:32
ARMNN_LOG
#define ARMNN_LOG(severity)
Definition: Logging.hpp:212
armnn::CreateSupportedBackends
BackendsMap CreateSupportedBackends(TensorHandleFactoryRegistry &handleFactoryRegistry, BackendSettings &backendSettings)
Definition: Network.cpp:1354
armnn::optimizations::ConvertConstantsFloatToHalf
ConvertConstants< Float32ToFloat16, IsFloat16Layer > ConvertConstantsFloatToHalf
Definition: ConvertConstants.hpp:99
ARMNN_SCOPED_PROFILING_EVENT
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
Definition: Profiling.hpp:220
armnn::ReportError
void ReportError(const std::string &errorMessage, Optional< std::vector< std::string > & > errorMessages)
Definition: Network.cpp:762
armnn::CheckFp16Support
bool CheckFp16Support(BackendsMap &backends, const std::vector< BackendId > &availablePreferredBackends)
Definition: Network.cpp:1045
armnn::BackendRegistryInstance
BackendRegistry & BackendRegistryInstance()
Definition: BackendRegistry.cpp:15
armnn::optimizations::FusePermuteIntoConstLayer
OptimizeForConnection< ConstantLayer, PermuteLayer, ConvertConstPermuteLayersToConstLayers > FusePermuteIntoConstLayer
Definition: ConvertConstPermuteLayersToConstLayers.hpp:124
armnn::MakeOptimizations
Optimizer::Optimizations MakeOptimizations(Args &&... args)
Definition: Optimizer.hpp:43
armnn::RuntimeException
Definition: Exceptions.hpp:120
armnn::IOptimizedNetwork::Optimize
friend IOptimizedNetworkPtr Optimize(const INetwork &inNetwork, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptionsOpaque &options, Optional< std::vector< std::string > & > messages)
Create an optimized version of the network.
Definition: Network.cpp:2279
armnn::CheckFastMathSupport
bool CheckFastMathSupport(const std::vector< BackendId > &availablePreferredBackends, const ModelOptions &modelOptions)
Definition: Network.cpp:1944
armnn::ShapeInferenceMethod::ValidateOnly
@ ValidateOnly
Validate all output shapes.
armnn::ShapeInferenceMethod::InferAndValidate
@ InferAndValidate
Infer missing output shapes and validate all output shapes.
armnn::optimizations::OptimizeInverseConversionsFp32
OptimizeForConnection< ConvertFp32ToFp16Layer, ConvertFp16ToFp32Layer, OptimizeInverseConversionsImpl > OptimizeInverseConversionsFp32
Definition: OptimizeInverseConversions.hpp:44
armnn::BackendOptions
Struct for the users to pass backend specific options.
Definition: BackendOptions.hpp:22
armnn::BackendRegistry::GetMappedGpuBackends
BackendIdVector GetMappedGpuBackends()
Definition: BackendRegistry.cpp:160
armnn::optimizations::TransposeAsReshape
OptimizeForType< TransposeLayer, TransposeAsReshapeImpl > TransposeAsReshape
Definition: TransposeAsReshape.hpp:77
armnn::ProfilerManager::GetInstance
static ProfilerManager & GetInstance()
Definition: Profiling.cpp:602
armnn::optimizations::FuseBatchNormIntoConvolution2DFloat16
OptimizeForExclusiveConnection< Convolution2dLayer, BatchNormalizationLayer, FuseBatchNorm< Convolution2dLayer, armnn::DataType::Float16 > > FuseBatchNormIntoConvolution2DFloat16
Definition: FuseBatchNorm.hpp:227
armnn::IOptimizedNetwork::Destroy
static void Destroy(IOptimizedNetwork *network)
Definition: Network.cpp:706
armnn::BackendId
Definition: BackendId.hpp:75
armnn::optimizations::FuseBatchNormIntoDepthwiseConvolution2DFloat16
OptimizeForExclusiveConnection< DepthwiseConvolution2dLayer, BatchNormalizationLayer, FuseBatchNorm< DepthwiseConvolution2dLayer, armnn::DataType::Float16 > > FuseBatchNormIntoDepthwiseConvolution2DFloat16
Definition: FuseBatchNorm.hpp:237
armnn::BackendsMap
std::map< BackendId, std::unique_ptr< class IBackendInternal > > BackendsMap
Definition: Network.hpp:285
armnn::optimizations::SquashEqualTransposeSiblings
OptimizeForConnection< Layer, TransposeLayer, SquashEqualSiblingsImpl< TransposeLayer > > SquashEqualTransposeSiblings
Definition: SquashEqualSiblings.hpp:69
armnn::optimizations::ConvertConstantsHalfToFloat
ConvertConstants< Float16ToFloat32, IsFloat32Layer > ConvertConstantsHalfToFloat
Definition: ConvertConstants.hpp:98
armnn::IOptimizedNetwork::IOptimizedNetwork
IOptimizedNetwork(const IOptimizedNetwork &other, const ModelOptions &modelOptions)
Creates a copy of the IOptimizedNetwork.
Definition: Network.cpp:692
armnn::optimizations::SquashEqualPermuteSiblings
OptimizeForConnection< Layer, PermuteLayer, SquashEqualSiblingsImpl< PermuteLayer > > SquashEqualPermuteSiblings
Definition: SquashEqualSiblings.hpp:67
armnn::Optimizer::Pass
static void Pass(Graph &graph, const Optimizations &optimizations)
Definition: Optimizer.cpp:16
armnn::ModelOptions
std::vector< BackendOptions > ModelOptions
Definition: BackendOptions.hpp:18
armnn::optimizations::FoldPadIntoDepthwiseConvolution2d
OptimizeForExclusiveConnection< PadLayer, DepthwiseConvolution2dLayer, pad_fold::FoldPadIntoDepthwiseConvolution2dImpl > FoldPadIntoDepthwiseConvolution2d
Definition: FoldPadIntoLayer2d.hpp:281
armnnUtils::Filesystem::CreateDirectory
std::string CreateDirectory(std::string sPath)
Returns full path to temporary folder.
Definition: Filesystem.cpp:47
armnn::optimizations::MaxMinIntoBoundedRelu
OptimizeForExclusiveConnection< ElementwiseBinaryLayer, ElementwiseBinaryLayer, MaxMinIntoBoundedReluImpl > MaxMinIntoBoundedRelu
Definition: MaxMinIntoBoundedRelu.hpp:134
armnn::optimizations::SquashEqualReshapeSiblings
OptimizeForConnection< Layer, ReshapeLayer, SquashEqualSiblingsImpl< ReshapeLayer > > SquashEqualReshapeSiblings
Definition: SquashEqualSiblings.hpp:70
armnn::optimizations::OptimizeInverseTransposes
OptimizeForConnection< TransposeLayer, TransposeLayer, OptimizeInversePermutesImpl< TransposeLayer > > OptimizeInverseTransposes
Definition: OptimizeInversePermutes.hpp:45
armnn::optimizations::AddBroadcastReshapeLayer
OptimizeForType< Layer, AddBroadcastReshapeLayerImpl > AddBroadcastReshapeLayer
Definition: AddBroadcastReshapeLayer.hpp:94
armnn::optimizations::FuseBatchNormIntoDepthwiseConvolution2DFloat32
OptimizeForExclusiveConnection< DepthwiseConvolution2dLayer, BatchNormalizationLayer, FuseBatchNorm< DepthwiseConvolution2dLayer, armnn::DataType::Float32 > > FuseBatchNormIntoDepthwiseConvolution2DFloat32
Definition: FuseBatchNorm.hpp:232
armnn::optimizations::OptimizeConsecutiveReshapes
OptimizeForConnection< ReshapeLayer, ReshapeLayer, OptimizeConsecutiveReshapesImpl > OptimizeConsecutiveReshapes
Definition: OptimizeConsecutiveReshapes.hpp:61
armnn::IOptimizedNetwork::pOptimizedNetworkImpl
std::unique_ptr< OptimizedNetworkImpl > pOptimizedNetworkImpl
Definition: INetwork.hpp:953