30#include <client/include/IProfilingService.hpp>
32#include <common/include/ProfilingGuid.hpp>
34#include <fmt/format.h>
62 bool importEnabled,
ModelOptions modelOptions,
bool exportEnabled,
65 importEnabled, modelOptions,
66 exportEnabled, debugToFile))
72 bool importEnabled,
ModelOptions modelOptions,
bool exportEnabled,
73 bool debugToFile,
bool allowExpandedDims)
75 shapeInferenceMethod, importEnabled,
76 modelOptions, exportEnabled,
77 debugToFile, allowExpandedDims))
84 p_OptimizerOptionsImpl->m_ImportEnabled = OptimizerStruct.
m_ImportEnabled;
86 p_OptimizerOptionsImpl->m_ModelOptions = OptimizerStruct.
m_ModelOptions;
88 p_OptimizerOptionsImpl->m_DebugToFile = OptimizerStruct.
m_DebugToFile;
89 p_OptimizerOptionsImpl->m_Debug = OptimizerStruct.
m_Debug;
91 p_OptimizerOptionsImpl->m_ExportEnabled = OptimizerStruct.
m_ExportEnabled;
113 p_OptimizerOptionsImpl->m_ImportEnabled = ImportState;
118 p_OptimizerOptionsImpl->m_ExportEnabled = ExportState;
123 p_OptimizerOptionsImpl->m_ProfilingEnabled = ProfilingState;
128 p_OptimizerOptionsImpl->m_Debug = DebugState;
133 p_OptimizerOptionsImpl->m_DebugToFile = DebugFileState;
138 p_OptimizerOptionsImpl->m_ReduceFp32ToFp16 = ReduceFp32ToFp16State;
143 p_OptimizerOptionsImpl->m_shapeInferenceMethod = ShapeInferenceMethodType;
148 p_OptimizerOptionsImpl->m_AllowExpandedDims = ExpandedDimsAllowed;
153 p_OptimizerOptionsImpl->m_ModelOptions.push_back(NewModelOption);
158 return p_OptimizerOptionsImpl->m_ProfilingEnabled;
163 return p_OptimizerOptionsImpl->m_ImportEnabled;
168 return p_OptimizerOptionsImpl->m_ExportEnabled;
173 return p_OptimizerOptionsImpl->m_ReduceFp32ToFp16;
178 return p_OptimizerOptionsImpl->m_ReduceFp32ToBf16;
183 return p_OptimizerOptionsImpl->m_Debug;
188 return p_OptimizerOptionsImpl->m_DebugToFile;
193 return p_OptimizerOptionsImpl->m_AllowExpandedDims;
198 return p_OptimizerOptionsImpl->m_ModelOptions;
203 return p_OptimizerOptionsImpl->m_shapeInferenceMethod;
208 std::stringstream stream;
209 stream <<
"OptimizerOptions: \n";
210 stream <<
"\tReduceFp32ToFp16: " << p_OptimizerOptionsImpl->m_ReduceFp32ToFp16 <<
"\n";
211 stream <<
"\tReduceFp32ToBf16: " << p_OptimizerOptionsImpl->m_ReduceFp32ToBf16 <<
"\n";
212 stream <<
"\tDebug: " << p_OptimizerOptionsImpl->m_Debug <<
"\n";
213 stream <<
"\tDebug to file: " << p_OptimizerOptionsImpl->m_DebugToFile <<
"\n";
214 stream <<
"\tShapeInferenceMethod: " <<
216 "ValidateOnly" :
"InferAndValidate") <<
"\n";
217 stream <<
"\tImportEnabled: " << p_OptimizerOptionsImpl->m_ImportEnabled <<
"\n";
218 stream <<
"\tExportEnabled: " << p_OptimizerOptionsImpl->m_ExportEnabled <<
"\n";
219 stream <<
"\tProfilingEnabled: " << p_OptimizerOptionsImpl->m_ProfilingEnabled <<
"\n";
220 stream <<
"\tAllowExpandedDims: " << p_OptimizerOptionsImpl->m_AllowExpandedDims <<
"\n";
222 stream <<
"\tModelOptions: \n";
223 for (
auto optionsGroup : p_OptimizerOptionsImpl->m_ModelOptions)
225 for (
size_t i=0; i < optionsGroup.GetOptionCount(); i++)
228 stream <<
"\t\tBackend: " << optionsGroup.GetBackendId() <<
"\n"
229 <<
"\t\t\tOption: " << option.
GetName() <<
"\n"
261 return pNetworkImpl->AddComparisonLayer(comparisonDescriptor, name);
268 return pNetworkImpl->AddConcatLayer(concatDescriptor, name);
275 return pNetworkImpl->AddConvolution2dLayer(convolution2dDescriptor, name);
281 return pNetworkImpl->AddConvolution3dLayer(convolution3dDescriptor, name);
288 return pNetworkImpl->AddDepthToSpaceLayer(depthToSpaceDescriptor, name);
296 return pNetworkImpl->AddDepthwiseConvolution2dLayer(convolution2dDescriptor, name);
311 return pNetworkImpl->AddDetectionPostProcessLayer(descriptor, anchors, name);
317 return pNetworkImpl->AddElementwiseBinaryLayer(elementwiseBinaryDescriptor, name);
323 return pNetworkImpl->AddElementwiseUnaryLayer(elementwiseUnaryDescriptor, name);
329 return pNetworkImpl->AddFillLayer(fillDescriptor, name);
335 return pNetworkImpl->AddFullyConnectedLayer(fullyConnectedDescriptor, name);
341 return pNetworkImpl->AddFusedLayer(fusedDescriptor, name);
347 return pNetworkImpl->AddPermuteLayer(permuteDescriptor, name);
353 return pNetworkImpl->AddBatchToSpaceNdLayer(batchToSpaceNdDescriptor, name);
359 return pNetworkImpl->AddPooling2dLayer(pooling2dDescriptor, name);
365 return pNetworkImpl->AddPooling3dLayer(pooling3dDescriptor, name);
373 return pNetworkImpl->AddPrecompiledLayer(preCompiledDescriptor, std::move(compiledBlobPtr), backend, name);
379 return pNetworkImpl->AddActivationLayer(activationDescriptor, name);
385 return pNetworkImpl->AddNormalizationLayer(normalizationDescriptor, name);
390 return pNetworkImpl->AddSliceLayer(sliceDescriptor, name);
395 return pNetworkImpl->AddSoftmaxLayer(softmaxDescriptor, name);
401 return pNetworkImpl->AddSplitterLayer(splitterDescriptor, name);
430 return pNetworkImpl->AddBatchNormalizationLayer(desc, mean, variance, beta, gamma, name);
441 return pNetworkImpl->AddResizeLayer(resizeDescriptor, name);
447 return pNetworkImpl->AddReduceLayer(reduceDescriptor, name);
453 return pNetworkImpl->AddInstanceNormalizationLayer(desc, name);
459 return pNetworkImpl->AddL2NormalizationLayer(desc, name);
465 return pNetworkImpl->AddLogSoftmaxLayer(logSoftmaxDescriptor, name);
477 return pNetworkImpl->AddReshapeLayer(reshapeDescriptor, name);
483 return pNetworkImpl->AddSpaceToBatchNdLayer(spaceToBatchNdDescriptor, name);
489 return pNetworkImpl->AddSpaceToDepthLayer(spaceToDepthDescriptor, name);
505 return pNetworkImpl->AddLstmLayer(descriptor, params, name);
531 return pNetworkImpl->AddMeanLayer(meanDescriptor, name);
548 return pNetworkImpl->AddStridedSliceLayer(stridedSliceDescriptor, name);
584 return pNetworkImpl->AddTransposeConvolution2dLayer(descriptor, weights, biases, name);
590 return pNetworkImpl->AddTransposeLayer(transposeDescriptor, name);
613 return pNetworkImpl->AddQuantizedLstmLayer(params, name);
620 return pNetworkImpl->AddQLstmLayer(descriptor, params, name);
626 return pNetworkImpl->AddLogicalBinaryLayer(descriptor, name);
634 return pNetworkImpl->AddUnidirectionalSequenceLstmLayer(descriptor, params, name);
640 return pNetworkImpl->AddChannelShuffleLayer(descriptor, name);
646 return pNetworkImpl->AddBatchMatMulLayer(descriptor, name);
663 return pNetworkImpl->AddBroadcastToLayer(descriptor, name);
669 return pNetworkImpl->AddScatterNdLayer(descriptor, name);
679 return new INetwork(networkOptions);
749 return m_Graph->SerializeToDot(stream);
754 return m_Graph->GetNumInputs();
759 return m_Graph->GetNumOutputs();
763 Optional<std::vector<std::string>&> errorMessages)
765 std::stringstream fullErrorMessage;
766 fullErrorMessage <<
"ERROR: " << errorMessage;
770 errorMessages.value().push_back(fullErrorMessage.str());
775 Optional<std::vector<std::string>&> warningMessages)
777 std::stringstream fullWarningMessage;
778 fullWarningMessage <<
"WARNING: " << warningMessage;
782 warningMessages.value().push_back(fullWarningMessage.str());
790 Optional<std::vector<std::string>&> errMessages)
792 std::stringstream failureMsg;
803 bool noErrors =
true;
805 for (
unsigned int i = 0; i < numOutputs; i++) {
808 auto quantizationDataType =
info.GetDataType();
809 auto quantizationScales =
info.GetQuantizationScales();
811 switch(quantizationDataType) {
817 &&
info.HasPerAxisQuantization()) {
819 "Asymmetric Quantization Datatype.");
823 (
info.GetQuantizationScale() != (1.0f / 256.0f) ||
824 info.GetQuantizationOffset() != 0) &&
826 std::stringstream ss;
827 ss <<
"Quantization parameters for Softmax layer (Scale: " <<
828 info.GetQuantizationScale() <<
" and Offset: " <<
info.GetQuantizationOffset() <<
829 ") are incorrect and have been updated to Scale: 0.00390625 and Offset: 0";
831 info.SetQuantizationScale((1.0f / 256.0f));
832 info.SetQuantizationOffset(0);
850 const std::vector<BackendId>& availablePreferredBackends,
851 std::string& reasonIfUnsupported,
852 Optional<std::vector<std::string>&> messages)
857 auto ReturnError = [&](
const Layer* layer)
865 std::string currentReasonIfUnsupported;
871 reasonIfUnsupported += currentReasonIfUnsupported;
872 if (!isLayerSupported &&
HasCapability(
"AllOrNothing", backend))
875 if (
GetCapability(
"AllOrNothing", backend).value().GetValue().AsBool())
879 std::stringstream fullWarningMessage;
880 fullWarningMessage <<
"Backend: " << backend
881 <<
" has \"AllOrNothing\" enabled. A layer of type "
883 <<
"This backend will not be considered to execute this subgraph.";
884 reasonIfUnsupported.append(fullWarningMessage.str());
894 std::string checkStr =
"This CPU architecture does not support F16 data type, you need v8.2 or above";
895 if (!isLayerSupported || currentReasonIfUnsupported.find(checkStr) != std::string::npos)
903 auto ConstantLayerFromFp16ToFp32 = [](
Layer& layer)
913 std::vector<float> newValues(
info.GetNumElements());
917 info.GetNumElements(),
930 bool checkType =
false;
934 auto connectedOutputSlot = inputSlot.GetConnectedOutputSlot();
937 if (connectedOutputSlot->GetNumConnections() == 1)
940 ConstantLayerFromFp16ToFp32(connectedOutputSlot->GetOwningLayer());
946 std::vector<ConvertFp16ToFp32Layer*> convertFp16ToFp32Layers;
949 convertFp16ToFp32Layers =
954 std::vector<ConvertFp32ToFp16Layer*> convertFp32ToFp16Layers;
957 convertFp32ToFp16Layers =
962 auto AssignFirstSupportedBackend = [&](
Layer* layer,
BackendId preferredBackend)
964 bool supportedBackendFound =
false;
965 std::string reasonIfUnsupported;
971 reasonIfUnsupported))
973 supportedBackendFound =
true;
977 for (
const auto& backend : availablePreferredBackends)
980 if (backend == preferredBackend)
988 reasonIfUnsupported))
990 supportedBackendFound =
true;
996 return supportedBackendFound;
1001 if (!AssignFirstSupportedBackend(convertLayer, backend))
1003 return ReturnError(convertLayer);
1009 if (!AssignFirstSupportedBackend(convertLayer, backend))
1011 return ReturnError(convertLayer);
1019 std::stringstream warningMsg;
1021 <<
" is not supported on requested backend " << layer->
GetBackendId().
Get()
1024 <<
" (reason: " << reasonIfUnsupported
1025 <<
"), falling back to the next backend.";
1042 return {dataTypeIn, dataTypeOut};
1046 const std::vector<BackendId>& availablePreferredBackends)
1048 bool hasFp16 =
false;
1050 auto firstBackend = availablePreferredBackends[0];
1051 auto backendObjPtr = backends.find(firstBackend)->second.get();
1054 auto backendCapabilities = backendObjPtr->GetCapabilities();
1060 ARMNN_LOG(
debug) <<
"The first available preferred backend: " << firstBackend
1061 <<
", has FP16 support.";
1065 ARMNN_LOG(
debug) <<
"The first available preferred backend: " << firstBackend
1066 <<
", does not have FP16 support. "
1067 <<
"The FP16 turbo mode option will be disable. It will run using FP32.";
1071 for (
size_t i = 1; i < availablePreferredBackends.size(); ++i)
1073 auto backend = availablePreferredBackends[i];
1074 backendObjPtr = backends.find(backend)->second.get();
1075 backendCapabilities = backendObjPtr->GetCapabilities();
1078 ARMNN_LOG(
debug) <<
"Next preferred backend: " << backend <<
", does not have FP16 support. "
1079 <<
"It will run using FP32 when falling back to this backend.";
1083 ARMNN_LOG(
debug) <<
"Next preferred backend: " << backend <<
", has FP16 support.";
1094 Optional<std::vector<std::string>&> errMessages,
1097 std::vector<BackendId>& availablePreferredBackends,
1100 auto ReturnError = [&](
const Layer* layer)
1114 std::string reasonIfUnsupported;
1124 if (layer->GetBackendHint().has_value() &&
1129 layer->GetBackendHint().value(),
1132 availablePreferredBackends,
1133 reasonIfUnsupported,
1134 errMessages).IsOk())
1142 for (
const auto& backend : availablePreferredBackends)
1144 if (layer->GetBackendHint().has_value() &&
1145 layer->GetBackendHint().value() == backend)
1156 availablePreferredBackends,
1157 reasonIfUnsupported,
1175 if (reasonIfUnsupported.find(
"AllOrNothing") != std::string::npos)
1200 layer->SetBackendId(cpuBackendId);
1205 result = ReturnError(layer);
1215 Optional<std::vector<std::string>&> errMessages)
1220 bool restart =
false;
1222 for (
auto it = firstLayer; it != lastLayer; it = (restart ? firstLayer : ++it))
1224 if (it == firstLayer)
1227 if (availablePreferredBackends.empty())
1229 ReportError(
"No preferred backends are available", errMessages);
1244 availablePreferredBackends,
1248 for (
auto it = firstLayer; it != lastLayer; ++it)
1258 bool isFloat16 =
false;
1259 for (
auto type : inOutDataType)
1268 if (layer->GetBackendId() ==
"Unknown" || isFloat16)
1275 availablePreferredBackends,
1280 for (
auto it = firstLayer; it != lastLayer; ++it)
1286 BackendId connectedBackendId = layer->GetOutputSlot(0).GetConnection(0)->GetOwningLayer().GetBackendId();
1287 layer->SetBackendId(connectedBackendId);
1298 Optional<std::vector<std::string>&> errMessages)
1304 if (availablePreferredBackends.empty())
1306 std::stringstream failureMsg;
1307 failureMsg <<
"No preferred backends are available";
1314 bool restart =
false;
1315 for (
auto it = firstLayer; it != lastLayer; ++it)
1322 availablePreferredBackends,
1326 for (
auto it = firstLayer; it != lastLayer; ++it)
1332 BackendId connectedBackendId = layer->GetOutputSlot(0).GetConnection(0)->GetOwningLayer().GetBackendId();
1333 layer->SetBackendId(connectedBackendId);
1343 Optional<std::vector<std::string>&> errMessages)
1361 auto backendFactory = backendRegistry.GetFactory(selectedBackend);
1362 auto backendObjPtr = backendFactory();
1364 backendObjPtr->RegisterTensorHandleFactories(handleFactoryRegistry);
1366 backends[backendObjPtr->GetId()] = std::move(backendObjPtr);
1376 Optional<std::vector<std::string>&> errMessages)
1387 auto backendObjPtr = backends.find(selectedBackend)->second.get();
1407 [&backendObjPtr](
const Layer& layer)
1414 if (subgraphs.empty())
1421 for (
auto& subgraph : subgraphs)
1425 OptimizationViews optimizationViews = backendObjPtr->OptimizeSubgraphView(*subgraph, modelOptions);
1426 if (!optimizationViews.
Validate(*subgraph))
1435 SubgraphView& replacementSubgraph = substitution.m_ReplacementSubgraph;
1436 SubgraphView& substitutableSubgraph = substitution.m_SubstitutableSubgraph;
1441 std::for_each(subgraphLayers.begin(), subgraphLayers.end(), [&selectedBackend](
IConnectableLayer* l)
1443 PolymorphicDowncast<Layer*>(l)->SetBackendId(selectedBackend);
1450 for (
auto& l : deletedSubgraph.GetIConnectableLayers())
1456 OutputSlot* parentOut = inputSlot.GetConnectedOutputSlot();
1471 std::stringstream warningMsg;
1472 warningMsg <<
"Some sub-graph(s) failed to optimized on " << backendObjPtr->GetId() <<
" backend.";
1477 if (!backendObjPtr->GetId().IsCpuRef())
1487 std::stringstream subgraphMsg;
1488 subgraphMsg <<
"Re-assigning backends to " << failedSubgraph.GetIConnectableLayers().size()
1489 <<
" layers inside sub-graph " << count++;
1496 if (reassignmentResult.
m_Error)
1519 if (srcFactory && dstFactory &&
1549 if (frmBackend == backends.end() ||
1550 !frmBackend->second->SupportsTensorAllocatorAPI())
1557 std::map<ITensorHandleFactory::FactoryId, int> factoryScores;
1564 const Layer& connectedLayer = connection->GetOwningLayer();
1566 auto toBackend = backends.find(connectedLayer.
GetBackendId());
1567 if (toBackend == backends.end())
1572 if (!toBackend->second.get()->SupportsTensorAllocatorAPI())
1578 auto dstPrefs = toBackend->second.get()->GetHandleFactoryPreferences();
1579 for (
auto&& dst : dstPrefs)
1593 auto it = factoryScores.find(dst);
1594 if (it == factoryScores.end())
1597 factoryScores[dst] = 0;
1606 factoryScores[dst]++;
1609 if (factoryScores[dst] > topScore)
1611 topScore = factoryScores[dst];
1640 if (frmBackend == backends.end() ||
1641 !frmBackend->second->SupportsTensorAllocatorAPI())
1646 bool outputConnection =
false;
1649 const Layer& connectedLayer = connection->GetOwningLayer();
1652 outputConnection =
true;
1660 std::map<ITensorHandleFactory::FactoryId, int> factoryScores;
1661 for (
auto&& pref : srcPrefs)
1666 if (outputConnection)
1669 bool fallbackConnection =
false;
1672 if (inputSlot.GetConnectedOutputSlot()->GetOwningLayer().GetBackendId() != layer.
GetBackendId())
1674 fallbackConnection =
true;
1677 if (fallbackConnection)
1681 if (!factoryCap.empty())
1691 if (!outputConnection)
1695 if (!factoryCap.empty())
1714 auto it = factoryScores.find(pref);
1715 if (it == factoryScores.end())
1718 factoryScores[pref] = 0;
1725 const Layer& connectedLayer = connection->GetOwningLayer();
1727 auto toBackend = backends.find(connectedLayer.
GetBackendId());
1728 if (toBackend == backends.end())
1733 auto dstPrefs = toBackend->second.get()->GetHandleFactoryPreferences();
1734 for (
auto&& src : srcPrefs)
1736 if (factoryScores.find(src) == factoryScores.end())
1741 for (
auto&& dst : dstPrefs)
1746 factoryScores[src]++;
1754 int minScore = std::numeric_limits<int>::max();
1755 for (
auto it : factoryScores)
1757 minScore = std::min(minScore, it.second);
1761 std::vector<ITensorHandleFactory::FactoryId> optimalFactories;
1762 for (
auto it : factoryScores)
1764 if (it.second == minScore)
1766 optimalFactories.push_back(it.first);
1771 for (
auto&& srcPref : srcPrefs)
1773 for (
auto&& comp : optimalFactories)
1775 if (comp == srcPref)
1788 const Layer& connectedLayer,
1792 auto toBackend = backends.find(connectedLayer.
GetBackendId());
1793 if (toBackend == backends.end())
1798 auto dstPrefs = toBackend->second.get()->GetHandleFactoryPreferences();
1821 for (
auto&& pref : dstPrefs)
1823 if (pref == srcFactoryId)
1833 for (
auto&& pref : dstPrefs)
1852 if (srcCapability.empty() && dstCapability.empty() && srcFallback.empty() && dstFallback.empty())
1863 for (
auto&& pref : dstPrefs)
1882 Optional<std::vector<std::string>&> errMessages)
1887 optGraph.
ForEachLayer([&backends, ®istry, &result, &errMessages, importEnabled, exportEnabled](
Layer* layer)
1891 if (backends.find(layer->
GetBackendId()) == backends.end())
1919 unsigned int connectionIdx = 0;
1922 const Layer& connectedLayer = connection->GetOwningLayer();
1925 registry, importEnabled);
1932 errMessages.value().emplace_back(
"Could not find valid strategy required for compatibility"
1933 " between backends.");
1951 bool hasFastMath =
false;
1953 auto firstBackend = availablePreferredBackends[0];
1954 if (!modelOptions.empty())
1958 if (name ==
"FastMathEnabled")
1960 hasFastMath = value.
AsBool();
1961 ARMNN_LOG(
debug) <<
"The first available preferred backend: " << firstBackend
1962 <<
", has FastMath support.";
1968 ARMNN_LOG(
warning) <<
"The first available preferred backend: " << firstBackend
1969 <<
", does not have FastMath support. "
1970 <<
"Support for Turbo mode for TfLite post quantized FP16 models wil be disabled.";
1983 bool atLeastOneDequantizeEncountered =
false;
1984 for (
auto it = firstLayer; it != lastLayer; ++it)
1989 auto& connectedLayer = layer->GetOutputSlot(0).GetConnection(0)->GetOwningLayer();
1992 if(!(connectedLayer.GetInputSlot(0).GetTensorInfo().GetDataType() ==
DataType::Float16 &&
1993 connectedLayer.GetOutputSlot(0).GetTensorInfo().GetDataType() ==
DataType::Float32))
1999 atLeastOneDequantizeEncountered =
true;
2004 if (!atLeastOneDequantizeEncountered)
2014 const std::vector<BackendId>& backendPreferences,
2017 Optional<std::vector<std::string>&> messages)
2027 const std::vector<BackendId>& backendPreferences,
2030 Optional<std::vector<std::string>&> messages)
2040 if (backendPreferences.empty())
2048 "Please use the FastMathEnabled backend option for CpuAcc or GpuAcc.");
2059 std::unique_ptr<Graph> graph = std::make_unique<Graph>(inGraph);
2067 optimizedOptions.push_back(importExport);
2102 if (availablePreferredBackends.empty())
2104 std::stringstream failureMsg;
2105 failureMsg <<
"None of the preferred backends " << backendPreferences
2122 reduceFp32ToFp16 =
true;
2136 SquashEqualTransposeSiblings(),
2137 SquashEqualReshapeSiblings(),
2138 OptimizeInversePermutes(),
2139 OptimizeInverseTransposes(),
2143 TransposeAsReshape(),
2144 OptimizeConsecutiveReshapes(),
2145 BroadcastToOptimizationLayer(),
2146 PermuteAndBatchToSpaceAsDepthToSpace(),
2147 TransposeAndBatchToSpaceAsDepthToSpace(),
2148 FuseBatchNormIntoConvolution2DFloat32(),
2149 FuseBatchNormIntoConvolution2DFloat16(),
2150 FuseBatchNormIntoDepthwiseConvolution2DFloat32(),
2151 FuseBatchNormIntoDepthwiseConvolution2DFloat16()));
2156 for (
auto backend : mappedGpuBackends)
2158 if (std::count(backendPreferences.begin(), backendPreferences.end(), backend)
2159 && (backendPreferences[0] != backend) &&
2162 std::stringstream failureMsg;
2163 failureMsg << backend <<
" backend cannot be specified as fallback.";
2169 std::vector<BackendId> amendedBackendPreferences = backendPreferences;
2174 for (
auto backend : mappedGpuBackends)
2176 if (!std::count(amendedBackendPreferences.begin(), amendedBackendPreferences.end(), backend))
2178 amendedBackendPreferences.insert(amendedBackendPreferences.begin(), backend);
2183 if (reduceFp32ToFp16 && hasFp16)
2197 if (assignBackendsResult.
m_Error)
2204 OptimizeInverseConversionsFp32()));
2212 if (backendOptimizationResult.
m_Error)
2237#if !defined(ARMNN_DISABLE_FILESYSTEM)
2239 ARMNN_LOG(
info) <<
"Intermediate tensors will be written to: " << result;
2253 tensorHandleFactoryRegistry,
2275 const std::vector<BackendId>& backendPreferences,
2278 Optional<std::vector<std::string>&> messages)
2288 const std::vector<BackendId>& backendPreferences,
2291 Optional<std::vector<std::string>&> messages)
2300bool NetworkImpl::GetShapeInferenceMethod()
2302 bool shapeInferenceMethod =
false;
2306 if (name ==
"InferAndValidate")
2308 shapeInferenceMethod |= value.
AsBool();
2311 return shapeInferenceMethod;
2314bool NetworkImpl::GetAllowExpandedDims()
2316 bool allowExpandedDims =
false;
2318 ParseOptions(m_NetworkOptions,
"AllowExpandedDims", [&](std::string name,
const BackendOptions::Var& value)
2320 if (name ==
"AllowExpandedDims")
2322 allowExpandedDims |= value.AsBool();
2325 return allowExpandedDims;
2329: m_NetworkOptions(networkOptions),
2330 m_Graph(
std::make_unique<
Graph>(GetShapeInferenceMethod(), GetAllowExpandedDims()))
2345 return m_Graph->AddLayer<
InputLayer>(id, name);
2356 return m_Graph->AddLayer<
CastLayer>(name);
2367 return m_Graph->AddLayer<
ComparisonLayer>(comparisonDescriptor, name);
2385 return m_Graph->AddLayer<
FillLayer>(fillDescriptor, name);
2397 return m_Graph->AddLayer<
FusedLayer>(fusedDescriptor, name);
2403 return m_Graph->AddLayer<
ConcatLayer>(concatDescriptor, name);
2446 layer->
m_Anchors = std::make_shared<ScopedTensorHandle>(anchors);
2454 return m_Graph->AddLayer<
PermuteLayer>(permuteDescriptor, name);
2460 return m_Graph->AddLayer<
Pooling2dLayer>(pooling2dDescriptor, name);
2466 return m_Graph->AddLayer<
Pooling3dLayer>(pooling3dDescriptor, name);
2472 return m_Graph->AddLayer<
ActivationLayer>(activationDescriptor, name);
2478 return m_Graph->AddLayer<
ArgMinMaxLayer>(argMinMaxDescriptor, name);
2482normalizationDescriptor,
2490 return m_Graph->AddLayer<
SliceLayer>(sliceDescriptor, name);
2496 return m_Graph->AddLayer<
SoftmaxLayer>(softmaxDescriptor, name);
2502 return m_Graph->AddLayer<
SplitterLayer>(splitterDescriptor, name);
2539 layer->
m_Mean = std::make_shared<ScopedTensorHandle>(mean);
2540 layer->m_Variance = std::make_shared<ScopedTensorHandle>(variance);
2541 layer->m_Beta = std::make_shared<ScopedTensorHandle>(beta);
2542 layer->m_Gamma = std::make_shared<ScopedTensorHandle>(gamma);
2549 return m_Graph->AddLayer<
RankLayer>(name);
2555 return m_Graph->AddLayer<
ReduceLayer>(reduceDescriptor, name);
2560 return m_Graph->AddLayer<
ResizeLayer>(resizeDescriptor, name);
2590 layer->
m_LayerOutput = std::make_shared<ScopedTensorHandle>(input);
2598 return m_Graph->AddLayer<
ReshapeLayer>(reshapeDescriptor, name);
2622 const auto layer = m_Graph->AddLayer<
LstmLayer>(descriptor, name);
2627 layer->m_BasicParameters.m_InputToCellWeights =
2629 layer->m_BasicParameters.m_InputToOutputWeights =
2631 layer->m_BasicParameters.m_RecurrentToForgetWeights =
2633 layer->m_BasicParameters.m_RecurrentToCellWeights =
2635 layer->m_BasicParameters.m_RecurrentToOutputWeights =
2637 layer->m_BasicParameters.m_ForgetGateBias =
2639 layer->m_BasicParameters.m_CellBias =
2640 std::make_shared<ScopedTensorHandle>(*(params.
m_CellBias));
2641 layer->m_BasicParameters.m_OutputGateBias =
2650 "when CIFG is disabled.");
2655 "AddLstmLayer: Recurrent To Input Weights cannot be NULL "
2656 "when CIFG is disabled.");
2661 "when CIFG is disabled.");
2663 layer->m_CifgParameters.m_InputToInputWeights =
2665 layer->m_CifgParameters.m_RecurrentToInputWeights =
2667 layer->m_CifgParameters.m_InputGateBias =
2677 "when projection is enabled.");
2679 layer->m_ProjectionParameters.m_ProjectionWeights =
2683 layer->m_ProjectionParameters.m_ProjectionBias =
2696 "when Peephole is enabled and CIFG disabled.");
2699 layer->m_PeepholeParameters.m_CellToInputWeights =
2706 "when Peephole is enabled.");
2711 "when Peephole is enabled.");
2714 layer->m_PeepholeParameters.m_CellToForgetWeights =
2716 layer->m_PeepholeParameters.m_CellToOutputWeights =
2728 "when layer normalization is enabled and CIFG disabled.");
2730 layer->m_LayerNormParameters.m_InputLayerNormWeights =
2737 "when layer normalization is enabled.");
2742 "when layer normalization is enabled.");
2747 "when layer normalization is enabled.");
2749 layer->m_LayerNormParameters.m_ForgetLayerNormWeights =
2751 layer->m_LayerNormParameters.m_CellLayerNormWeights =
2753 layer->m_LayerNormParameters.m_OutputLayerNormWeights =
2771 return m_Graph->AddLayer<
MeanLayer>(meanDescriptor,name);
2776 return m_Graph->AddLayer<
PadLayer>(padDescriptor,name);
2798 return m_Graph->AddLayer<
GatherLayer>(gatherDescriptor, name);
2833 layer->
m_Weight = std::make_shared<ScopedTensorHandle>(weights);
2837 layer->m_Bias = std::make_shared<ScopedTensorHandle>(biases.
value());
2846 return m_Graph->AddLayer<
TransposeLayer>(transposeDescriptor, name);
2852 return m_Graph->AddLayer<
StackLayer>(stackDescriptor, name);
2870 layer->m_QuantizedLstmParameters.m_InputToForgetWeights =
2872 layer->m_QuantizedLstmParameters.m_InputToCellWeights =
2874 layer->m_QuantizedLstmParameters.m_InputToOutputWeights =
2878 layer->m_QuantizedLstmParameters.m_RecurrentToInputWeights =
2880 layer->m_QuantizedLstmParameters.m_RecurrentToForgetWeights =
2882 layer->m_QuantizedLstmParameters.m_RecurrentToCellWeights =
2884 layer->m_QuantizedLstmParameters.m_RecurrentToOutputWeights =
2888 layer->m_QuantizedLstmParameters.m_InputGateBias =
2890 layer->m_QuantizedLstmParameters.m_ForgetGateBias =
2892 layer->m_QuantizedLstmParameters.m_CellBias =
2893 std::make_shared<ScopedTensorHandle>(params.
GetCellBias());
2894 layer->m_QuantizedLstmParameters.m_OutputGateBias =
2904 const auto layer = m_Graph->AddLayer<
QLstmLayer>(descriptor, name);
2909 layer->m_BasicParameters.m_InputToCellWeights =
2911 layer->m_BasicParameters.m_InputToOutputWeights =
2913 layer->m_BasicParameters.m_RecurrentToForgetWeights =
2915 layer->m_BasicParameters.m_RecurrentToCellWeights =
2917 layer->m_BasicParameters.m_RecurrentToOutputWeights =
2919 layer->m_BasicParameters.m_ForgetGateBias =
2921 layer->m_BasicParameters.m_CellBias =
2922 std::make_shared<ScopedTensorHandle>(*(params.
m_CellBias));
2923 layer->m_BasicParameters.m_OutputGateBias =
2937 "AddQLstmLayer: Recurrent To Input Weights cannot be NULL");
2945 layer->m_CifgParameters.m_InputToInputWeights =
2947 layer->m_CifgParameters.m_RecurrentToInputWeights =
2949 layer->m_CifgParameters.m_InputGateBias =
2961 layer->m_ProjectionParameters.m_ProjectionWeights =
2967 layer->m_ProjectionParameters.m_ProjectionBias =
2993 layer->m_PeepholeParameters.m_CellToInputWeights =
2997 layer->m_PeepholeParameters.m_CellToForgetWeights =
2999 layer->m_PeepholeParameters.m_CellToOutputWeights =
3028 layer->m_LayerNormParameters.m_InputLayerNormWeights =
3032 layer->m_LayerNormParameters.m_ForgetLayerNormWeights =
3034 layer->m_LayerNormParameters.m_CellLayerNormWeights =
3036 layer->m_LayerNormParameters.m_OutputLayerNormWeights =
3058 layer->m_BasicParameters.m_InputToCellWeights =
3060 layer->m_BasicParameters.m_InputToOutputWeights =
3062 layer->m_BasicParameters.m_RecurrentToForgetWeights =
3064 layer->m_BasicParameters.m_RecurrentToCellWeights =
3066 layer->m_BasicParameters.m_RecurrentToOutputWeights =
3068 layer->m_BasicParameters.m_ForgetGateBias =
3070 layer->m_BasicParameters.m_CellBias =
3071 std::make_shared<ScopedTensorHandle>(*(params.
m_CellBias));
3072 layer->m_BasicParameters.m_OutputGateBias =
3081 "when CIFG is disabled.");
3086 "AddUnidirectionalSequenceLstmLayer: Recurrent To Input Weights cannot be NULL "
3087 "when CIFG is disabled.");
3092 "when CIFG is disabled.");
3094 layer->m_CifgParameters.m_InputToInputWeights =
3096 layer->m_CifgParameters.m_RecurrentToInputWeights =
3098 layer->m_CifgParameters.m_InputGateBias =
3108 "when projection is enabled.");
3110 layer->m_ProjectionParameters.m_ProjectionWeights =
3114 layer->m_ProjectionParameters.m_ProjectionBias =
3127 "cannot be NULL when Peephole is enabled and CIFG disabled.");
3130 layer->m_PeepholeParameters.m_CellToInputWeights =
3137 "when Peephole is enabled.");
3142 "when Peephole is enabled.");
3145 layer->m_PeepholeParameters.m_CellToForgetWeights =
3147 layer->m_PeepholeParameters.m_CellToOutputWeights =
3159 "cannot be NULL when layer normalization is enabled and CIFG disabled.");
3161 layer->m_LayerNormParameters.m_InputLayerNormWeights =
3168 "cannot be NULL when layer normalization is enabled.");
3173 "cannot be NULL when layer normalization is enabled.");
3178 "cannot be NULL when layer normalization is enabled.");
3180 layer->m_LayerNormParameters.m_ForgetLayerNormWeights =
3182 layer->m_LayerNormParameters.m_CellLayerNormWeights =
3184 layer->m_LayerNormParameters.m_OutputLayerNormWeights =
3202 return m_Graph->AddLayer<
TileLayer>(desc, name);
3218 layer = m_Graph->AddLayer<
PreCompiledLayer>(preCompiledDescriptor,
"pre-compiled");
3252 layer->ExecuteStrategy(strategy);
3257 : m_Graph(new
Graph(*other.m_Graph.get()))
3258 , m_Guid(
arm::pipe::IProfilingService::GetNextGuid())
3259 , m_ModelOptions(modelOptions)
3264 : m_Graph(
std::move(graph)), m_Guid(
arm::pipe::IProfilingService::GetNextGuid())
3269 : m_Graph(
std::move(graph)), m_Guid(
arm::pipe::IProfilingService::GetNextGuid()), m_ModelOptions(modelOptions)
3286 layer->ExecuteStrategy(strategy);
#define ARMNN_NO_DEPRECATE_WARN_BEGIN
#define ARMNN_NO_DEPRECATE_WARN_END
#define ARMNN_LOG(severity)
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
This layer represents an activation operation with the specified activation function.
This layer represents an addition operation.
This layer represents a ArgMinMax operation.
const std::string & Get() const
Very basic type safe variant.
bool AsBool() const
Value getters.
BackendIdSet GetBackendIds() const
BackendIdVector GetMappedGpuBackends()
This layer represents a batch normalization operation.
std::shared_ptr< ConstTensorHandle > m_Mean
A unique pointer to store Mean values.
This layer represents a BatchToSpaceNd operation.
This layer represents a cast operation.
This layer represents a comparison operation.
This layer represents a merge operation.
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
A layer that the constant data can be bound to.
std::shared_ptr< ConstTensorHandle > m_LayerOutput
This layer converts data type Float 16 to Float 32.
This layer converts data type Float 32 to Float 16.
This layer represents a convolution 2d operation.
This layer represents a convolution 3d operation.
This layer represents a DepthToSpace operation.
This layer represents a depthwise convolution 2d operation.
This layer dequantizes the input tensor.
This layer represents a detection postprocess operator.
std::shared_ptr< ConstTensorHandle > m_Anchors
A unique pointer to store Anchor values.
This layer represents a division operation.
This layer represents a elementwiseBinary operation.
This layer represents a elementwiseUnary operation.
Base class for all ArmNN exceptions so that users can filter to just those.
virtual const char * what() const noexcept override
This layer represents a fill operation.
This layer represents a floor operation.
This layer represents a fully connected operation.
This layer represents a Gather operator.
This layer represents a GatherNd operator.
Iterator begin()
Returns iterator pointing to the beginning of the list. Lowercase for range-based for loops.
void VerifyConstantLayerSetTensorInfo() const
For each ConstantLayer in Graph, ensures TensorInfo is set on all output slots.
const std::shared_ptr< IProfiler > & GetProfiler() const
void EraseLayer(Iterator pos)
Deletes the layer at the specified position.
void SubstituteSubgraph(SubgraphView &subgraph, IConnectableLayer *substituteLayer)
Substitutes the given sub-graph with either a new layer or a new sub-graph.
Iterator end()
Returns iterator pointing to the end of the list. Lowercase for range-based for loops.
TransformIterator< decltype(&PtrCast< const Layer >), Iterator > ConstIterator
LayerList::const_iterator Iterator
void ForEachLayer(Func func) const
void AddCompatibilityLayers(std::map< BackendId, std::unique_ptr< class IBackendInternal > > &backends, TensorHandleFactoryRegistry ®istry)
Modifies the graph in-place, removing edges connecting layers using different compute devices,...
virtual std::vector< ITensorHandleFactory::FactoryId > GetHandleFactoryPreferences() const
(Optional) Returns a vector of supported TensorHandleFactory ids in preference order.
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Device specific knowledge to be passed to the optimizer.
Main network class which provides the interface for building up a neural network.
IConnectableLayer * AddFusedLayer(const FusedDescriptor &fusedDescriptor, const char *name=nullptr)
Adds a Fused layer to the network.
IConnectableLayer * AddElementwiseUnaryLayer(const ElementwiseUnaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr)
Add an ElementwiseUnary layer to the network.
IConnectableLayer * AddLstmLayer(const LstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
Add a Lstm layer to the network.
IConnectableLayer * AddDivisionLayer(const char *name=nullptr)
Adds a division layer to the network.
IConnectableLayer * AddQuantizeLayer(const char *name=nullptr)
Add a quantize layer to the network.
IConnectableLayer * AddMergeLayer(const char *name=nullptr)
Adds a merge layer to the network.
IConnectableLayer * AddPermuteLayer(const PermuteDescriptor &permuteDescriptor, const char *name=nullptr)
Adds a permute layer to the network.
IConnectableLayer * AddSpaceToDepthLayer(const SpaceToDepthDescriptor &spaceToDepthDescriptor, const char *name=nullptr)
Adds a space to depth layer to the network.
IConnectableLayer * AddConstantLayer(const ConstTensor &input, const char *name=nullptr)
Adds a layer with no inputs and a single output, which always corresponds to the passed in constant t...
IConnectableLayer * AddGatherLayer(const GatherDescriptor &descriptor, const char *name=nullptr)
Add Gather layer to the network.
IConnectableLayer * AddRankLayer(const char *name=nullptr)
Adds a rank layer to the network.
IConnectableLayer * AddSwitchLayer(const char *name=nullptr)
Adds a switch layer to the network.
IConnectableLayer * AddQLstmLayer(const QLstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
Add a QLstm layer to the network.
INetwork(NetworkOptions networkOptions={})
IConnectableLayer * AddSoftmaxLayer(const SoftmaxDescriptor &softmaxDescriptor, const char *name=nullptr)
Adds a softmax layer to the network.
IConnectableLayer * AddDequantizeLayer(const char *name=nullptr)
Adds a Dequantize layer to the network.
IConnectableLayer * AddBroadcastToLayer(const BroadcastToDescriptor &descriptor, const char *name=nullptr)
Add a BroadcastTo layer to the network.
IConnectableLayer * AddConvolution2dLayer(const Convolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
Adds a 2D convolution layer to the network.
IConnectableLayer * AddAdditionLayer(const char *name=nullptr)
Adds an addition layer to the network.
IConnectableLayer * AddQuantizedLstmLayer(const QuantizedLstmInputParams ¶ms, const char *name=nullptr)
Add a QuantizedLstm layer to the network.
static INetworkPtr Create(const NetworkOptions &networkOptions={})
IConnectableLayer * AddTransposeConvolution2dLayer(const TransposeConvolution2dDescriptor &descriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr)
Adds a 2D transpose convolution layer to the network.
std::unique_ptr< NetworkImpl > pNetworkImpl
IConnectableLayer * AddFloorLayer(const char *name=nullptr)
Adds a floor layer to the network.
IConnectableLayer * AddConvolution3dLayer(const Convolution3dDescriptor &convolution3dDescriptor, const char *name=nullptr)
Adds a 3D convolution layer to the network.
IConnectableLayer * AddFullyConnectedLayer(const FullyConnectedDescriptor &fullyConnectedDescriptor, const char *name=nullptr)
Adds a fully connected layer to the network.
IConnectableLayer * AddMinimumLayer(const char *name=nullptr)
Add a Minimum layer to the network.
IConnectableLayer * AddStackLayer(const StackDescriptor &descriptor, const char *name=nullptr)
Adds a stack layer to the network.
static void Destroy(INetwork *network)
IConnectableLayer * AddMaximumLayer(const char *name=nullptr)
Add a Maximum layer to the network.
IConnectableLayer * AddNormalizationLayer(const NormalizationDescriptor &normalizationDescriptor, const char *name=nullptr)
Adds a normalization layer to the network.
IConnectableLayer * AddPreluLayer(const char *name=nullptr)
Adds a PReLU layer to the network.
IConnectableLayer * AddPadLayer(const PadDescriptor &padDescriptor, const char *name=nullptr)
Adds a fully pad layer to the network.
IConnectableLayer * AddSplitterLayer(const ViewsDescriptor &splitterDescriptor, const char *name=nullptr)
Adds a splitter layer to the network.
void ExecuteStrategy(IStrategy &strategy) const
IConnectableLayer * AddSpaceToBatchNdLayer(const SpaceToBatchNdDescriptor &spaceToBatchNdDescriptor, const char *name=nullptr)
Adds a space to batch layer to the network.
IConnectableLayer * AddCastLayer(const char *name=nullptr)
Adds a cast layer to the network.
IConnectableLayer * AddStandInLayer(const StandInDescriptor &descriptor, const char *name=nullptr)
Add a stand-in layer for a type unknown to the Arm NN framework.
IConnectableLayer * AddChannelShuffleLayer(const ChannelShuffleDescriptor &descriptor, const char *name=nullptr)
Add a ChannelShuffle layer to the network.
IConnectableLayer * AddLogicalBinaryLayer(const LogicalBinaryDescriptor &descriptor, const char *name=nullptr)
Adds a Logical Binary layer to the network.
IConnectableLayer * AddLogSoftmaxLayer(const LogSoftmaxDescriptor &logSoftmaxDescriptor, const char *name=nullptr)
Adds a log softmax layer to the network.
IConnectableLayer * AddReshapeLayer(const ReshapeDescriptor &reshapeDescriptor, const char *name=nullptr)
Adds a reshape layer to the network.
IConnectableLayer * AddSliceLayer(const SliceDescriptor &sliceDescriptor, const char *name=nullptr)
Adds a slice layer to the network.
IConnectableLayer * AddBatchNormalizationLayer(const BatchNormalizationDescriptor &desc, const ConstTensor &mean, const ConstTensor &variance, const ConstTensor &beta, const ConstTensor &gamma, const char *name=nullptr)
Adds a batch normalization layer to the network.
IConnectableLayer * AddBatchToSpaceNdLayer(const BatchToSpaceNdDescriptor &batchToSpaceNdDescriptor, const char *name=nullptr)
Adds a batch to space ND layer to the network.
IConnectableLayer * AddActivationLayer(const ActivationDescriptor &activationDescriptor, const char *name=nullptr)
Adds an activation layer to the network.
IConnectableLayer * AddInputLayer(LayerBindingId id, const char *name=nullptr)
Adds an input layer to the network.
IConnectableLayer * AddElementwiseBinaryLayer(const ElementwiseBinaryDescriptor &elementwiseBinaryDescriptor, const char *name=nullptr)
Add an ElementwiseBinary layer to the network.
IConnectableLayer * AddL2NormalizationLayer(const L2NormalizationDescriptor &desc, const char *name=nullptr)
Adds an L2 normalization layer to the network.
IConnectableLayer * AddTransposeLayer(const TransposeDescriptor &transposeDescriptor, const char *name=nullptr)
Adds a transpose layer to the network.
static INetwork * CreateRaw(const NetworkOptions &networkOptions={})
IConnectableLayer * AddUnidirectionalSequenceLstmLayer(const UnidirectionalSequenceLstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
Add a UnidirectionalSequenceLstm layer to the network.
IConnectableLayer * AddMultiplicationLayer(const char *name=nullptr)
Adds a multiplication layer to the network.
IConnectableLayer * AddInstanceNormalizationLayer(const InstanceNormalizationDescriptor &desc, const char *name=nullptr)
Adds an instance normalization layer to the network.
IConnectableLayer * AddDetectionPostProcessLayer(const DetectionPostProcessDescriptor &descriptor, const ConstTensor &anchors, const char *name=nullptr)
Adds a Detection PostProcess layer to the network.
IConnectableLayer * AddStridedSliceLayer(const StridedSliceDescriptor &stridedSliceDescriptor, const char *name=nullptr)
Adds a strided slice layer to the network.
IConnectableLayer * AddTileLayer(const TileDescriptor &descriptor, const char *name=nullptr)
Add a Tile layer to the network.
IConnectableLayer * AddDepthwiseConvolution2dLayer(const DepthwiseConvolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
Adds a 2D depthwise convolution layer to the network.
IConnectableLayer * AddComparisonLayer(const ComparisonDescriptor &comparisonDescriptor, const char *name=nullptr)
Add a Comparison layer to the network.
IConnectableLayer * AddMeanLayer(const MeanDescriptor &meanDescriptor, const char *name=nullptr)
Add a Mean layer to the network.
IConnectableLayer * AddResizeLayer(const ResizeDescriptor &resizeDescriptor, const char *name=nullptr)
Adds a resize layer to the network.
IConnectableLayer * AddArgMinMaxLayer(const ArgMinMaxDescriptor &desc, const char *name=nullptr)
Adds an ArgMinMax layer to the network.
IConnectableLayer * AddReduceLayer(const ReduceDescriptor &reduceDescriptor, const char *name=nullptr)
Adds a reduce layer to the network.
IConnectableLayer * AddPooling2dLayer(const Pooling2dDescriptor &pooling2dDescriptor, const char *name=nullptr)
Adds a 2D pooling layer to the network.
IConnectableLayer * AddConcatLayer(const ConcatDescriptor &concatDescriptor, const char *name=nullptr)
Adds a concatenation layer to the network.
IConnectableLayer * AddBatchMatMulLayer(const BatchMatMulDescriptor &descriptor, const char *name=nullptr)
Add a BatchMatMul layer to the network.
IConnectableLayer * AddPooling3dLayer(const Pooling3dDescriptor &pooling3dDescriptor, const char *name=nullptr)
Adds a 3D pooling layer to the network.
IConnectableLayer * AddPrecompiledLayer(const PreCompiledDescriptor &preCompiledDescriptor, CompiledBlobPtr compiledBlobPtr, const Optional< BackendId > &backend, const char *name=nullptr)
Adds a Precompiled layer to the network.
IConnectableLayer * AddSubtractionLayer(const char *name=nullptr)
Adds a subtraction layer to the network.
IConnectableLayer * AddDepthToSpaceLayer(const DepthToSpaceDescriptor &depthToSpaceDescriptor, const char *name=nullptr)
Adds a depth to space layer to the network.
IConnectableLayer * AddOutputLayer(LayerBindingId id, const char *name=nullptr)
Adds an output layer to the network.
IConnectableLayer * AddReverseV2Layer(const char *name=nullptr)
Add a ReverseV2 layer to the network.
IConnectableLayer * AddGatherNdLayer(const char *name=nullptr)
Add GatherNd layer to the network.
IConnectableLayer * AddShapeLayer(const char *name=nullptr)
Adds a shape layer to the network.
IConnectableLayer * AddFillLayer(const FillDescriptor &fillDescriptor, const char *name=nullptr)
Add an Fill layer to the network.
IConnectableLayer * AddScatterNdLayer(const ScatterNdDescriptor &descriptor, const char *name=nullptr)
Add a ScatterNd layer to the network.
Status SerializeToDot(std::ostream &stream) const
IOptimizedNetwork(const IOptimizedNetwork &other, const ModelOptions &modelOptions)
Creates a copy of the IOptimizedNetwork.
std::unique_ptr< OptimizedNetworkImpl > pOptimizedNetworkImpl
static void Destroy(IOptimizedNetwork *network)
size_t GetNumOutputs() const
void ExecuteStrategy(IStrategy &strategy) const
const std::shared_ptr< IProfiler > & GetProfiler() const
size_t GetNumInputs() const
arm::pipe::ProfilingGuid GetGuid() const
virtual std::vector< Capability > GetCapabilities(const IConnectableLayer *layer, const IConnectableLayer *connectedLayer, CapabilityClass capabilityClass)
virtual MemorySourceFlags GetExportFlags() const
static const FactoryId LegacyFactoryId
virtual MemorySourceFlags GetImportFlags() const
static const FactoryId DeferredFactoryId
Use the workload factory to create the tensor handle.
virtual bool SupportsMapUnmap() const
static bool IsLayerSupported(const BackendId &backendId, const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported)
This layer represents an instance normalization operation.
This layer represents a L2 normalization operation.
unsigned int GetNumOutputSlots() const override
Returns the number of connectable output slots.
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
void SetBackendId(const BackendId &id) override
Set the backend of the IConnectableLayer.
const std::vector< InputSlot > & GetInputSlots() const
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
unsigned int GetNumInputSlots() const override
Returns the number of connectable input slots.
LayerType GetType() const override
Returns the armnn::LayerType of this layer.
const BackendId & GetBackendId() const
Optional< BackendId > GetBackendHint() const
This layer represents a log softmax operation.
This layer represents a Logical Binary operation.
This layer represents a LSTM operation.
LstmBasicParameters m_BasicParameters
This layer represents a maximum operation.
This layer represents a mean operation.
This layer dequantizes the input tensor.
This layer represents a minimum operation.
This layer represents a multiplication operation.
Private implementation of INetwork.
IConnectableLayer * AddFusedLayer(const FusedDescriptor &fusedDescriptor, const char *name=nullptr)
IConnectableLayer * AddElementwiseUnaryLayer(const ElementwiseUnaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr)
IConnectableLayer * AddLstmLayer(const LstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
IConnectableLayer * AddDivisionLayer(const char *name=nullptr)
IConnectableLayer * AddQuantizeLayer(const char *name=nullptr)
IConnectableLayer * AddMergeLayer(const char *name=nullptr)
IConnectableLayer * AddPermuteLayer(const PermuteDescriptor &permuteDescriptor, const char *name=nullptr)
IConnectableLayer * AddSpaceToDepthLayer(const SpaceToDepthDescriptor &spaceToDepthDescriptor, const char *name=nullptr)
IConnectableLayer * AddConstantLayer(const ConstTensor &input, const char *name=nullptr)
NetworkImpl(const NetworkOptions &networkOptions={})
IConnectableLayer * AddLogicalBinaryLayer(const LogicalBinaryDescriptor &logicalBinaryDescriptor, const char *name=nullptr)
IConnectableLayer * AddConvertFp16ToFp32Layer(const char *name=nullptr)
IConnectableLayer * AddRankLayer(const char *name=nullptr)
IConnectableLayer * AddSwitchLayer(const char *name=nullptr)
IConnectableLayer * AddQLstmLayer(const QLstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
IConnectableLayer * AddSoftmaxLayer(const SoftmaxDescriptor &softmaxDescriptor, const char *name=nullptr)
IConnectableLayer * AddDequantizeLayer(const char *name=nullptr)
IConnectableLayer * AddBroadcastToLayer(const BroadcastToDescriptor &descriptor, const char *name=nullptr)
IConnectableLayer * AddConvolution2dLayer(const Convolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
IConnectableLayer * AddAdditionLayer(const char *name=nullptr)
IConnectableLayer * AddQuantizedLstmLayer(const QuantizedLstmInputParams ¶ms, const char *name=nullptr)
IConnectableLayer * AddTransposeConvolution2dLayer(const TransposeConvolution2dDescriptor &descriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr)
IConnectableLayer * AddFloorLayer(const char *name=nullptr)
IConnectableLayer * AddConvolution3dLayer(const Convolution3dDescriptor &convolution3dDescriptor, const char *name=nullptr)
IConnectableLayer * AddStackLayer(const StackDescriptor &stackDescriptor, const char *name=nullptr)
IConnectableLayer * AddFullyConnectedLayer(const FullyConnectedDescriptor &fullyConnectedDescriptor, const char *name=nullptr)
IConnectableLayer * AddMinimumLayer(const char *name=nullptr)
IConnectableLayer * AddMaximumLayer(const char *name=nullptr)
IConnectableLayer * AddChannelShuffleLayer(const ChannelShuffleDescriptor &channelShuffleDescriptor, const char *name=nullptr)
IConnectableLayer * AddNormalizationLayer(const NormalizationDescriptor &normalizationDescriptor, const char *name=nullptr)
IConnectableLayer * AddPreluLayer(const char *name=nullptr)
IConnectableLayer * AddPadLayer(const PadDescriptor &padDescriptor, const char *name=nullptr)
IConnectableLayer * AddSplitterLayer(const ViewsDescriptor &splitterDescriptor, const char *name=nullptr)
void ExecuteStrategy(IStrategy &strategy) const
IConnectableLayer * AddSpaceToBatchNdLayer(const SpaceToBatchNdDescriptor &spaceToBatchNdDescriptor, const char *name=nullptr)
IConnectableLayer * AddCastLayer(const char *name=nullptr)
IConnectableLayer * AddStandInLayer(const StandInDescriptor &descriptor, const char *name=nullptr)
IConnectableLayer * AddScatterNdLayer(const ScatterNdDescriptor &scatterDescriptor, const char *name=nullptr)
IConnectableLayer * AddBatchMatMulLayer(const BatchMatMulDescriptor &desc, const char *name=nullptr)
IConnectableLayer * AddLogSoftmaxLayer(const LogSoftmaxDescriptor &logSoftmaxDescriptor, const char *name=nullptr)
const Graph & GetGraph() const
IConnectableLayer * AddReshapeLayer(const ReshapeDescriptor &reshapeDescriptor, const char *name=nullptr)
IConnectableLayer * AddSliceLayer(const SliceDescriptor &sliceDescriptor, const char *name=nullptr)
IConnectableLayer * AddBatchNormalizationLayer(const BatchNormalizationDescriptor &desc, const ConstTensor &mean, const ConstTensor &variance, const ConstTensor &beta, const ConstTensor &gamma, const char *name=nullptr)
IConnectableLayer * AddBatchToSpaceNdLayer(const BatchToSpaceNdDescriptor &batchToSpaceNdDescriptor, const char *name=nullptr)
IConnectableLayer * AddActivationLayer(const ActivationDescriptor &activationDescriptor, const char *name=nullptr)
IConnectableLayer * AddInputLayer(LayerBindingId id, const char *name=nullptr)
IConnectableLayer * AddElementwiseBinaryLayer(const ElementwiseBinaryDescriptor &elementwiseBinaryDescriptor, const char *name=nullptr)
IConnectableLayer * AddTileLayer(const TileDescriptor &tileDescriptor, const char *name=nullptr)
IConnectableLayer * AddGatherLayer(const GatherDescriptor &gatherDescriptor, const char *name=nullptr)
IConnectableLayer * AddL2NormalizationLayer(const L2NormalizationDescriptor &desc, const char *name=nullptr)
IConnectableLayer * AddTransposeLayer(const TransposeDescriptor &transposeDescriptor, const char *name=nullptr)
IConnectableLayer * AddConvertFp32ToFp16Layer(const char *name=nullptr)
IConnectableLayer * AddUnidirectionalSequenceLstmLayer(const UnidirectionalSequenceLstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
IConnectableLayer * AddMultiplicationLayer(const char *name=nullptr)
IConnectableLayer * AddInstanceNormalizationLayer(const InstanceNormalizationDescriptor &desc, const char *name=nullptr)
IConnectableLayer * AddDetectionPostProcessLayer(const DetectionPostProcessDescriptor &descriptor, const ConstTensor &anchors, const char *name=nullptr)
IConnectableLayer * AddStridedSliceLayer(const StridedSliceDescriptor &stridedSliceDescriptor, const char *name=nullptr)
IConnectableLayer * AddDepthwiseConvolution2dLayer(const DepthwiseConvolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
IConnectableLayer * AddComparisonLayer(const ComparisonDescriptor &comparisonDescriptor, const char *name=nullptr)
IConnectableLayer * AddMeanLayer(const MeanDescriptor &meanDescriptor, const char *name=nullptr)
IConnectableLayer * AddResizeLayer(const ResizeDescriptor &resizeDescriptor, const char *name=nullptr)
IConnectableLayer * AddArgMinMaxLayer(const ArgMinMaxDescriptor &desc, const char *name=nullptr)
IConnectableLayer * AddReduceLayer(const ReduceDescriptor &reduceDescriptor, const char *name=nullptr)
IConnectableLayer * AddPooling2dLayer(const Pooling2dDescriptor &pooling2dDescriptor, const char *name=nullptr)
IConnectableLayer * AddConcatLayer(const ConcatDescriptor &concatDescriptor, const char *name=nullptr)
IConnectableLayer * AddPooling3dLayer(const Pooling3dDescriptor &pooling3dDescriptor, const char *name=nullptr)
IConnectableLayer * AddPrecompiledLayer(const PreCompiledDescriptor &preCompiledDescriptor, CompiledBlobPtr compiledBlobPtr, const Optional< BackendId > &backend, const char *name=nullptr)
IConnectableLayer * AddSubtractionLayer(const char *name=nullptr)
IConnectableLayer * AddDepthToSpaceLayer(const DepthToSpaceDescriptor &depthToSpaceDescriptor, const char *name=nullptr)
IConnectableLayer * AddOutputLayer(LayerBindingId id, const char *name=nullptr)
IConnectableLayer * AddReverseV2Layer(const char *name=nullptr)
IConnectableLayer * AddGatherNdLayer(const char *name=nullptr)
IConnectableLayer * AddShapeLayer(const char *name=nullptr)
IConnectableLayer * AddFillLayer(const FillDescriptor &fillDescriptor, const char *name=nullptr)
This layer represents a normalization operation.
bool Validate(const SubgraphView &originalSubgraph) const
const Subgraphs & GetDeletedSubgraphs() const
const Subgraphs & GetFailedSubgraphs() const
const Substitutions & GetSubstitutions() const
virtual ~OptimizedNetworkImpl()
virtual Status SerializeToDot(std::ostream &stream) const
virtual size_t GetNumOutputs() const
void ExecuteStrategy(IStrategy &strategy) const
virtual size_t GetNumInputs() const
OptimizedNetworkImpl(const OptimizedNetworkImpl &other, const ModelOptions &modelOptions)
virtual Status PrintGraph()
static void Pass(Graph &graph, const Optimizations &optimizations)
~OptimizerOptionsOpaque()
void AddModelOption(armnn::BackendOptions)
void SetDebugEnabled(bool DebugState)
OptimizerOptionsOpaque & operator=(OptimizerOptionsOpaque other)
bool GetImportEnabled() const
bool GetReduceFp32ToBf16() const
bool GetProfilingEnabled() const
void SetReduceFp32ToFp16(bool ReduceFp32ToFp16State)
armnn::ShapeInferenceMethod GetShapeInferenceMethod() const
void SetAllowExpandedDims(bool ExpandedDimsAllowed)
bool GetDebugEnabled() const
bool GetReduceFp32ToFp16() const
void SetProfilingEnabled(bool ProfilingState)
bool GetDebugToFileEnabled() const
void SetDebugToFileEnabled(bool DebugFileState)
void SetExportEnabled(bool ExportState)
const std::string ToString() const
void SetImportEnabled(bool ImportState)
armnn::ModelOptions GetModelOptions() const
void SetShapeInferenceMethod(armnn::ShapeInferenceMethod ShapeInferenceMethodType)
bool GetAllowExpandedDims() const
bool GetExportEnabled() const
bool has_value() const noexcept
A layer user-provided data can be bound to (e.g. inputs, outputs).
const InputSlot * GetConnection(unsigned int index) const override
unsigned int GetNumConnections() const override
void SetEdgeStrategy(unsigned int connectionIndex, EdgeStrategy strategy)
void SetTensorInfo(const TensorInfo &tensorInfo) override
Layer & GetOwningLayer() const
const std::vector< InputSlot * > & GetConnections() const
void Disconnect(InputSlot &slot)
const TensorInfo & GetTensorInfo() const override
int Connect(InputSlot &destination)
void SetTensorHandleFactory(const ITensorHandleFactory::FactoryId &id)
This layer represents a pad operation.
This layer represents a permutation operation.
This layer represents a pooling 2d operation.
This layer represents a pooling 3d operation.
void SetPreCompiledObject(PreCompiledObjectPtr preCompiledObject)
void RegisterProfiler(IProfiler *profiler)
static ProfilerManager & GetInstance()
This layer represents a QLstm operation.
QLstmBasicParameters m_BasicParameters
This layer represents a QuantizedLstm operation.
QuantizedLstmParameters m_QuantizedLstmParameters
This layer represents a reduction operation.
This layer represents a reshape operation.
This layer represents a resize operation.
This layer represents a ReverseV2 operation.
This layer represents a ScatterNd operator.
This layer represents a softmax operation.
This layer represents a SpaceToBatchNd operation.
This layer represents a SpaceToDepth operation.
This layer represents a split operation.
This layer represents a stack operation.
This layer represents an unknown operation in the input graph.
This layer represents a strided slice operation.
The SubgraphView class represents a subgraph of a Graph.
IConnectableLayers::iterator IConnectableLayerIterator
IConnectableLayerIterator begin()
const IConnectableLayers & GetIConnectableLayers() const
std::list< IConnectableLayer * > IConnectableLayers
IConnectableLayerIterator end()
static Subgraphs SelectSubgraphs(Graph &graph, const LayerSelectorFunction &selector)
Selects subgraphs from a graph based on the selector function and the algorithm.
std::vector< SubgraphView::SubgraphViewPtr > Subgraphs
This layer represents a subtraction operation.
This layer calculates both true and false outputs for input.
ITensorHandleFactory * GetFactory(ITensorHandleFactory::FactoryId id) const
Find a TensorHandleFactory by Id Returns nullptr if not found.
void SetDataType(DataType type)
DataType GetDataType() const
This layer represents a 2D transpose convolution operation.
std::shared_ptr< ConstTensorHandle > m_Weight
A unique pointer to store weight values.
This layer represents a transpose operation.
This layer represents a LSTM operation.
LstmBasicParameters m_BasicParameters
static void ConvertFloat16To32(const void *srcFloat16Buffer, size_t numElements, float *dstFloat32Buffer)
OptimizeForExclusiveConnection< PadLayer, DepthwiseConvolution2dLayer, pad_fold::FoldPadIntoDepthwiseConvolution2dImpl > FoldPadIntoDepthwiseConvolution2d
OptimizeForType< Layer, PermuteDepthwiseConv2dWeightsImpl > PermuteDepthwiseConv2dWeights
OptimizeForConnection< ConstantLayer, PermuteLayer, ConvertConstPermuteLayersToConstLayers > FusePermuteIntoConstLayer
OptimizeForExclusiveConnection< PadLayer, Pooling2dLayer, pad_fold::FoldPadIntoPooling2dImpl > FoldPadIntoPooling2d
OptimizeForExclusiveConnection< PadLayer, Convolution2dLayer, pad_fold::FoldPadIntoConvolution2dImpl > FoldPadIntoConvolution2d
Copyright (c) 2021 ARM Limited and Contributors.
bool IsTfLiteTurboModel(const Graph &optGraph)
EdgeStrategy CalculateEdgeStrategy(BackendsMap &backends, ITensorHandleFactory::FactoryId srcFactoryId, const Layer &layer, const Layer &connectedLayer, TensorHandleFactoryRegistry ®istry, bool importEnabled)
void ReportWarning(const std::string &warningMessage, Optional< std::vector< std::string > & > warningMessages)
OptimizationResult ReturnWithError(OptimizationResult res, const Layer *layer, const BackendSettings &backendSettings, Optional< std::vector< std::string > & > errMessages)
BackendsMap CreateSupportedBackends(TensorHandleFactoryRegistry &handleFactoryRegistry, BackendSettings &backendSettings)
Optimizer::Optimizations MakeOptimizations(Args &&... args)
constexpr const char * GetDataTypeName(DataType dataType)
bool CheckFp16Support(BackendsMap &backends, const std::vector< BackendId > &availablePreferredBackends)
ITensorHandleFactory::FactoryId CalculateSlotOptionForOutput(BackendsMap &backends, OutputSlot &slot, TensorHandleFactoryRegistry ®istry)
bool HasMatchingCapability(const BackendOptions::BackendOption &capability, const BackendCapabilities &capabilities)
Convenience function to check if a given capability matches a capability in a BackendCapabilities str...
std::vector< BackendOptions > NetworkOptions
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
bool CheckFastMathSupport(const std::vector< BackendId > &availablePreferredBackends, const ModelOptions &modelOptions)
std::vector< BackendOptions > ModelOptions
SpaceToDepthDescriptor DepthToSpaceDescriptor
A DepthToSpaceDescriptor for the DepthToSpaceLayer.
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Optional< const BackendOptions::BackendOption > GetCapability(const std::string &backendCapabilityName, const BackendCapabilities &capabilities)
Returns a BackendCapability if the backend lists the capability The BackendCapability must then be in...
OptimizationResult AttemptBackendAssignment(BackendSettings &backendSettings, Graph &graph, Layer *layer, BackendId backend, DataType dataTypeIn, DataType dataTypeOut, const std::vector< BackendId > &availablePreferredBackends, std::string &reasonIfUnsupported, Optional< std::vector< std::string > & > messages)
ITensorHandleFactory::FactoryId CalculateSlotOptionForInput(BackendsMap &backends, OutputSlot &slot, TensorHandleFactoryRegistry ®istry, bool importEnabled)
OriginsDescriptor ConcatDescriptor
bool RequiresCopy(ITensorHandleFactory::FactoryId src, ITensorHandleFactory::FactoryId dst, TensorHandleFactoryRegistry ®istry)
OptimizationResult AssignBackends(OptimizedNetworkImpl *optNetObjPtr, BackendSettings &backendSettings, Graph::Iterator &firstLayer, Graph::Iterator &lastLayer, Optional< std::vector< std::string > & > errMessages)
std::unique_ptr< void, CompiledBlobDeleter > CompiledBlobPtr
IOptimizedNetworkPtr Optimize(const INetwork &network, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptionsOpaque &options=OptimizerOptionsOpaque(), Optional< std::vector< std::string > & > messages=EmptyOptional())
Create an optimized version of the network.
DestType PolymorphicDowncast(SourceType *value)
Polymorphic downcast for build in pointers only.
OptimizationResult ApplyBackendOptimizations(OptimizedNetworkImpl *optNetObjPtr, BackendSettings &backendSettings, BackendsMap &backends, const ModelOptions &modelOptions, Optional< std::vector< std::string > & > errMessages)
int LayerBindingId
Type of identifiers for bindable layers (inputs, outputs).
void ReportError(const std::string &errorMessage, Optional< std::vector< std::string > & > errorMessages)
std::vector< DataType > GetLayerInOutDatatype(const Layer *layer)
void AssignBackendsIConnectable(OptimizedNetworkImpl *optNetObjPtr, IConnectableLayer *it, Optional< std::vector< std::string > & > errMessages, OptimizationResult &result, BackendSettings &backendSettings, std::vector< BackendId > &availablePreferredBackends, bool &restart)
bool HasCapability(const std::string &name, const BackendCapabilities &capabilities)
Convenience function to check if a capability exists in a BackendCapabilites struct.
std::vector< ConvertFp32ToFp16Layer * > InsertConvertFp32ToFp16LayersAfter(Graph &graph, Layer &layer)
BackendRegistry & BackendRegistryInstance()
std::vector< BackendId > BackendIdVector
OptimizationResult SelectTensorHandleStrategy(Graph &optGraph, BackendsMap &backends, TensorHandleFactoryRegistry ®istry, bool importEnabled, bool exportEnabled, Optional< std::vector< std::string > & > errMessages)
SoftmaxDescriptor LogSoftmaxDescriptor
A LogSoftmaxDescriptor for the LogSoftmaxLayer.
LstmDescriptor UnidirectionalSequenceLstmDescriptor
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
std::vector< ConvertFp16ToFp32Layer * > InsertConvertFp16ToFp32LayersBefore(Graph &graph, Layer &layer, bool expectCorrectInputType)
void ParseOptions(const std::vector< BackendOptions > &options, BackendId backend, F f)
const char * GetLayerTypeAsCString(LayerType type)
ShapeInferenceMethod
The ShapeInferenceMethod modify how the output shapes are treated.
@ InferAndValidate
Infer missing output shapes and validate all output shapes.
@ ValidateOnly
Validate all output shapes.
@ CpuAcc
CPU Execution: NEON: ArmCompute.
@ CpuRef
CPU Execution: Reference C++ kernels.
@ GpuAcc
GPU Execution: OpenCL: ArmCompute.
ITensorHandleFactory::FactoryId CalculateSlotOption(BackendsMap &backends, OutputSlot &outputSlot, TensorHandleFactoryRegistry ®istry, bool exportEnabled)
std::map< BackendId, std::unique_ptr< class IBackendInternal > > BackendsMap
bool CheckScaleSetOnQuantizedType(Layer *layer, Optional< std::vector< std::string > & > errMessages)
@ ExportToTarget
Destination backend can work directly with tensors on source backend.
@ DirectCompatibility
No strategy has been defined. Used internally to verify integrity of optimizations.
@ CopyToTarget
Source backends tensor data can be exported to destination backend tensor without copy.
void IgnoreUnused(Ts &&...)
std::string CreateDirectory(std::string sPath)
Returns full path to temporary folder.
An ActivationDescriptor for the ActivationLayer.
An ArgMinMaxDescriptor for ArgMinMaxLayer.
std::string GetName() const
Struct for the users to pass backend specific options.
BackendIdSet m_SupportedBackends
BackendIdSet m_IgnoredBackends
BackendIdSet m_SelectedBackends
bool IsBackendSupported(const BackendId &backend) const
BackendIdVector GetAvailablePreferredBackends() const
bool IsCpuRefUsed() const
BackendIdVector m_PreferredBackends
A BatchMatMulDescriptor for the BatchMatMul operator.
A BatchNormalizationDescriptor for the BatchNormalizationLayer.
A BatchToSpaceNdDescriptor for the BatchToSpaceNdLayer.
A ChannelShuffleDescriptor for the ChannelShuffle operator.
A ComparisonDescriptor for the ComparisonLayer.
A Convolution2dDescriptor for the Convolution2dLayer.
A Convolution3dDescriptor for the Convolution3dLayer.
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
A ElementwiseBinaryDescriptor for the ElementwiseBinaryLayer.
A ElementwiseUnaryDescriptor for the ElementwiseUnaryLayer.
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
A FillDescriptor for the FillLayer.
A FullyConnectedDescriptor for the FullyConnectedLayer.
A FusedDescriptor for the FusedLayer.
A GatherDescriptor for the GatherLayer.
An InstanceNormalizationDescriptor for InstanceNormalizationLayer.
A L2NormalizationDescriptor for the L2NormalizationLayer.
A LogicalBinaryDescriptor for the LogicalBinaryLayer.
std::shared_ptr< ConstTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
An LstmDescriptor for the LstmLayer.
bool m_PeepholeEnabled
Enable/disable peephole.
bool m_LayerNormEnabled
Enable/disable layer normalization.
bool m_ProjectionEnabled
Enable/disable the projection layer.
bool m_CifgEnabled
Enable/disable cifg (coupled input & forget gate).
A MeanDescriptor for the MeanLayer.
A NormalizationDescriptor for the NormalizationLayer.
bool IsWarningOnly() const
bool m_ExportEnabled
Enable Export.
bool m_ImportEnabled
Enable Import.
bool m_ReduceFp32ToBf16
@Note This feature has been replaced by enabling Fast Math in compute library backend options.
bool m_ProfilingEnabled
Enable profiling dump of the optimizer phase.
bool m_Debug
Add debug data for easier troubleshooting.
bool m_ReduceFp32ToFp16
Reduces all Fp32 operators in the model to Fp16 for faster processing.
ModelOptions m_ModelOptions
Enable Model Options.
ShapeInferenceMethod m_shapeInferenceMethod
Infer output size when not available.
bool m_AllowExpandedDims
When calculating tensor sizes, dimensions of size == 1 will be ignored.
bool m_DebugToFile
Pass debug data to separate output files for easier troubleshooting.
A PadDescriptor for the PadLayer.
A PermuteDescriptor for the PermuteLayer.
A Pooling2dDescriptor for the Pooling2dLayer.
A Pooling3dDescriptor for the Pooling3dLayer.
A PreCompiledDescriptor for the PreCompiledLayer.
std::shared_ptr< ConstTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8).
A QLstmDescriptor for the QLstmLayer.
bool m_PeepholeEnabled
Enable/disable peephole.
bool m_LayerNormEnabled
Enable/disable layer normalization.
bool m_ProjectionEnabled
Enable/disable the projection layer.
bool m_CifgEnabled
Enable/disable CIFG (coupled input & forget gate).
std::shared_ptr< ConstTensorHandle > m_InputToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [outputSize, inputSize] (QAsymm8).
A ReduceDescriptor for the REDUCE operators.
A ReshapeDescriptor for the ReshapeLayer.
A ResizeDescriptor for the ResizeLayer.
A ScatterNdDescriptor for the ScatterNdLayer.
A SliceDescriptor for the SliceLayer.
A SoftmaxDescriptor for the SoftmaxLayer.
A SpaceToBatchNdDescriptor for the SpaceToBatchNdLayer.
A SpaceToDepthDescriptor for the SpaceToDepthLayer.
A StackDescriptor for the StackLayer.
A StandInDescriptor for the StandIn layer.
A StridedSliceDescriptor for the StridedSliceLayer.
A TransposeConvolution2dDescriptor for the TransposeConvolution2dLayer.
bool m_BiasEnabled
Enable/disable bias.
A TransposeDescriptor for the TransposeLayer.
A ViewsDescriptor for the SplitterLayer.