23.05
|
Go to the documentation of this file.
30 #include <client/include/IProfilingService.hpp>
32 #include <common/include/ProfilingGuid.hpp>
34 #include <fmt/format.h>
61 bool importEnabled,
ModelOptions modelOptions,
bool exportEnabled,
64 importEnabled, modelOptions,
65 exportEnabled, debugToFile))
71 bool importEnabled,
ModelOptions modelOptions,
bool exportEnabled,
72 bool debugToFile,
bool allowExpandedDims)
74 shapeInferenceMethod, importEnabled,
75 modelOptions, exportEnabled,
76 debugToFile, allowExpandedDims))
83 p_OptimizerOptionsImpl->m_ImportEnabled = OptimizerStruct.
m_ImportEnabled;
85 p_OptimizerOptionsImpl->m_ModelOptions = OptimizerStruct.
m_ModelOptions;
87 p_OptimizerOptionsImpl->m_DebugToFile = OptimizerStruct.
m_DebugToFile;
88 p_OptimizerOptionsImpl->m_Debug = OptimizerStruct.
m_Debug;
90 p_OptimizerOptionsImpl->m_ExportEnabled = OptimizerStruct.
m_ExportEnabled;
112 p_OptimizerOptionsImpl->m_ImportEnabled = ImportState;
117 p_OptimizerOptionsImpl->m_ExportEnabled = ExportState;
122 p_OptimizerOptionsImpl->m_ProfilingEnabled = ProfilingState;
127 p_OptimizerOptionsImpl->m_Debug = DebugState;
132 p_OptimizerOptionsImpl->m_DebugToFile = DebugFileState;
137 p_OptimizerOptionsImpl->m_ReduceFp32ToFp16 = ReduceFp32ToFp16State;
142 p_OptimizerOptionsImpl->m_shapeInferenceMethod = ShapeInferenceMethodType;
147 p_OptimizerOptionsImpl->m_AllowExpandedDims = ExpandedDimsAllowed;
152 p_OptimizerOptionsImpl->m_ModelOptions.push_back(NewModelOption);
157 return p_OptimizerOptionsImpl->m_ProfilingEnabled;
162 return p_OptimizerOptionsImpl->m_ImportEnabled;
167 return p_OptimizerOptionsImpl->m_ExportEnabled;
172 return p_OptimizerOptionsImpl->m_ReduceFp32ToFp16;
177 return p_OptimizerOptionsImpl->m_ReduceFp32ToBf16;
182 return p_OptimizerOptionsImpl->m_Debug;
187 return p_OptimizerOptionsImpl->m_DebugToFile;
192 return p_OptimizerOptionsImpl->m_AllowExpandedDims;
197 return p_OptimizerOptionsImpl->m_ModelOptions;
202 return p_OptimizerOptionsImpl->m_shapeInferenceMethod;
207 std::stringstream stream;
208 stream <<
"OptimizerOptions: \n";
209 stream <<
"\tReduceFp32ToFp16: " << p_OptimizerOptionsImpl->m_ReduceFp32ToFp16 <<
"\n";
210 stream <<
"\tReduceFp32ToBf16: " << p_OptimizerOptionsImpl->m_ReduceFp32ToBf16 <<
"\n";
211 stream <<
"\tDebug: " << p_OptimizerOptionsImpl->m_Debug <<
"\n";
212 stream <<
"\tDebug to file: " << p_OptimizerOptionsImpl->m_DebugToFile <<
"\n";
213 stream <<
"\tShapeInferenceMethod: " <<
215 "ValidateOnly" :
"InferAndValidate") <<
"\n";
216 stream <<
"\tImportEnabled: " << p_OptimizerOptionsImpl->m_ImportEnabled <<
"\n";
217 stream <<
"\tExportEnabled: " << p_OptimizerOptionsImpl->m_ExportEnabled <<
"\n";
218 stream <<
"\tProfilingEnabled: " << p_OptimizerOptionsImpl->m_ProfilingEnabled <<
"\n";
219 stream <<
"\tAllowExpandedDims: " << p_OptimizerOptionsImpl->m_AllowExpandedDims <<
"\n";
221 stream <<
"\tModelOptions: \n";
222 for (
auto optionsGroup : p_OptimizerOptionsImpl->m_ModelOptions)
224 for (
size_t i=0; i < optionsGroup.GetOptionCount(); i++)
227 stream <<
"\t\tBackend: " << optionsGroup.GetBackendId() <<
"\n"
228 <<
"\t\t\tOption: " << option.
GetName() <<
"\n"
260 return pNetworkImpl->AddComparisonLayer(comparisonDescriptor, name);
267 return pNetworkImpl->AddConcatLayer(concatDescriptor, name);
274 return pNetworkImpl->AddConvolution2dLayer(convolution2dDescriptor, name);
280 return pNetworkImpl->AddConvolution3dLayer(convolution3dDescriptor, name);
287 return pNetworkImpl->AddDepthToSpaceLayer(depthToSpaceDescriptor, name);
295 return pNetworkImpl->AddDepthwiseConvolution2dLayer(convolution2dDescriptor, name);
310 return pNetworkImpl->AddDetectionPostProcessLayer(descriptor, anchors, name);
316 return pNetworkImpl->AddElementwiseBinaryLayer(elementwiseBinaryDescriptor, name);
322 return pNetworkImpl->AddElementwiseUnaryLayer(elementwiseUnaryDescriptor, name);
328 return pNetworkImpl->AddFillLayer(fillDescriptor, name);
334 return pNetworkImpl->AddFullyConnectedLayer(fullyConnectedDescriptor, name);
340 return pNetworkImpl->AddPermuteLayer(permuteDescriptor, name);
346 return pNetworkImpl->AddBatchToSpaceNdLayer(batchToSpaceNdDescriptor, name);
352 return pNetworkImpl->AddPooling2dLayer(pooling2dDescriptor, name);
358 return pNetworkImpl->AddPooling3dLayer(pooling3dDescriptor, name);
366 return pNetworkImpl->AddPrecompiledLayer(preCompiledDescriptor, std::move(compiledBlobPtr), backend, name);
372 return pNetworkImpl->AddActivationLayer(activationDescriptor, name);
378 return pNetworkImpl->AddNormalizationLayer(normalizationDescriptor, name);
383 return pNetworkImpl->AddSliceLayer(sliceDescriptor, name);
388 return pNetworkImpl->AddSoftmaxLayer(softmaxDescriptor, name);
394 return pNetworkImpl->AddSplitterLayer(splitterDescriptor, name);
423 return pNetworkImpl->AddBatchNormalizationLayer(desc, mean, variance, beta, gamma, name);
434 return pNetworkImpl->AddResizeLayer(resizeDescriptor, name);
440 return pNetworkImpl->AddReduceLayer(reduceDescriptor, name);
446 return pNetworkImpl->AddInstanceNormalizationLayer(desc, name);
452 return pNetworkImpl->AddL2NormalizationLayer(desc, name);
458 return pNetworkImpl->AddLogSoftmaxLayer(logSoftmaxDescriptor, name);
470 return pNetworkImpl->AddReshapeLayer(reshapeDescriptor, name);
476 return pNetworkImpl->AddSpaceToBatchNdLayer(spaceToBatchNdDescriptor, name);
482 return pNetworkImpl->AddSpaceToDepthLayer(spaceToDepthDescriptor, name);
498 return pNetworkImpl->AddLstmLayer(descriptor, params, name);
524 return pNetworkImpl->AddMeanLayer(meanDescriptor, name);
541 return pNetworkImpl->AddStridedSliceLayer(stridedSliceDescriptor, name);
577 return pNetworkImpl->AddTransposeConvolution2dLayer(descriptor, weights, biases, name);
583 return pNetworkImpl->AddTransposeLayer(transposeDescriptor, name);
606 return pNetworkImpl->AddQuantizedLstmLayer(params, name);
613 return pNetworkImpl->AddQLstmLayer(descriptor, params, name);
619 return pNetworkImpl->AddLogicalBinaryLayer(descriptor, name);
627 return pNetworkImpl->AddUnidirectionalSequenceLstmLayer(descriptor, params, name);
633 return pNetworkImpl->AddChannelShuffleLayer(descriptor, name);
639 return pNetworkImpl->AddBatchMatMulLayer(descriptor, name);
649 return new INetwork(networkOptions);
663 : pOptimizedNetworkImpl(new
OptimizedNetworkImpl(*other.pOptimizedNetworkImpl.get(), modelOptions)) {}
669 : pOptimizedNetworkImpl(
std::move(impl)) {}
719 return m_Graph->SerializeToDot(stream);
724 return m_Graph->GetNumInputs();
729 return m_Graph->GetNumOutputs();
733 Optional<std::vector<std::string>&> errorMessages)
735 std::stringstream fullErrorMessage;
736 fullErrorMessage <<
"ERROR: " << errorMessage;
740 errorMessages.value().push_back(fullErrorMessage.str());
745 Optional<std::vector<std::string>&> warningMessages)
747 std::stringstream fullWarningMessage;
748 fullWarningMessage <<
"WARNING: " << warningMessage;
752 warningMessages.value().push_back(fullWarningMessage.str());
759 Optional<std::vector<std::string>&> errMessages)
761 std::stringstream failureMsg;
773 bool noErrors =
true;
775 for (
unsigned int i = 0; i < numOutputs; i++) {
780 if (0.f ==
info.GetQuantizationScale())
783 std::stringstream ss;
785 <<
" (" << layer->
GetNameStr() <<
") is of type"
786 <<
" Quantized 8 bit but its scale parameter has not been set";
790 if ((
info.GetQuantizationScale() != (1.0f / 256.0f) ||
791 info.GetQuantizationOffset() != 0) &&
794 std::stringstream ss;
795 ss <<
"Quantization parameters for Softmax layer (Scale: " <<
796 info.GetQuantizationScale() <<
" and Offset: " <<
info.GetQuantizationOffset() <<
797 ") are incorrect and have been updated to Scale: 0.00390625 and Offset: 0";
799 info.SetQuantizationScale((1.0f /256.0f));
800 info.SetQuantizationOffset(0);
814 const std::vector<BackendId>& availablePreferredBackends,
815 std::string& reasonIfUnsupported,
816 Optional<std::vector<std::string>&> errMessages)
821 auto ReturnError = [&](
const Layer* layer)
834 std::string checkStr =
"This CPU architecture does not support F16 data type, you need v8.2 or above";
835 if (!isLayerSupported ||
836 reasonIfUnsupported.find(checkStr) != std::string::npos)
844 auto ConstantLayerFromFp16ToFp32 = [](
Layer& layer)
848 ConstantLayer* constantLayer = PolymorphicDowncast<ConstantLayer*>(&layer);
854 std::vector<float> newValues(
info.GetNumElements());
858 info.GetNumElements(),
871 bool checkType =
false;
875 auto connectedOutputSlot = inputSlot.GetConnectedOutputSlot();
878 if (connectedOutputSlot->GetNumConnections() == 1)
881 ConstantLayerFromFp16ToFp32(connectedOutputSlot->GetOwningLayer());
887 std::vector<ConvertFp16ToFp32Layer*> convertFp16ToFp32Layers;
890 convertFp16ToFp32Layers =
895 std::vector<ConvertFp32ToFp16Layer*> convertFp32ToFp16Layers;
898 convertFp32ToFp16Layers =
903 auto AssignFirstSupportedBackend = [&](
Layer* layer,
BackendId preferredBackend)
905 bool supportedBackendFound =
false;
906 std::string reasonIfUnsupported;
912 reasonIfUnsupported))
914 supportedBackendFound =
true;
918 for (
const auto& backend : availablePreferredBackends)
921 if (backend == preferredBackend)
929 reasonIfUnsupported))
931 supportedBackendFound =
true;
937 return supportedBackendFound;
942 if (!AssignFirstSupportedBackend(convertLayer, backend))
944 return ReturnError(convertLayer);
950 if (!AssignFirstSupportedBackend(convertLayer, backend))
952 return ReturnError(convertLayer);
960 std::stringstream warningMsg;
962 <<
" is not supported on requested backend " << layer->
GetBackendId().
Get()
965 <<
" (reason: " << reasonIfUnsupported
966 <<
"), falling back to the next backend.";
983 return {dataTypeIn, dataTypeOut};
990 Optional<std::vector<std::string>&> errMessages,
993 std::vector<BackendId>& availablePreferredBackends)
995 auto ReturnError = [&](
const Layer* layer)
1000 auto layer = PolymorphicDowncast<Layer*>(it);
1009 std::string reasonIfUnsupported;
1019 if (layer->GetBackendHint().has_value() &&
1024 layer->GetBackendHint().value(),
1027 availablePreferredBackends,
1028 reasonIfUnsupported,
1029 errMessages).
IsOk())
1037 for (
const auto& backend : availablePreferredBackends)
1039 if (layer->GetBackendHint().has_value() &&
1040 layer->GetBackendHint().value() == backend)
1051 availablePreferredBackends,
1052 reasonIfUnsupported,
1087 layer->SetBackendId(cpuBackendId);
1092 result = ReturnError(layer);
1102 Optional<std::vector<std::string>&> errMessages)
1108 if (availablePreferredBackends.empty())
1110 std::stringstream failureMsg;
1111 failureMsg <<
"No preferred backends are available";
1118 for (
auto it = firstLayer; it != lastLayer; ++it)
1120 auto layer = PolymorphicDowncast<Layer*>(*it);
1128 bool isFloat16 =
false;
1129 for (
auto type : inOutDataType)
1138 if (layer->GetBackendId() ==
"Unknown" || isFloat16)
1145 availablePreferredBackends);
1149 for (
auto it = firstLayer; it != lastLayer; ++it)
1151 auto layer = PolymorphicDowncast<Layer*>(*it);
1155 BackendId connectedBackendId = layer->GetOutputSlot(0).GetConnection(0)->GetOwningLayer().GetBackendId();
1156 layer->SetBackendId(connectedBackendId);
1167 Optional<std::vector<std::string>&> errMessages)
1173 if (availablePreferredBackends.empty())
1175 std::stringstream failureMsg;
1176 failureMsg <<
"No preferred backends are available";
1183 for (
auto it = firstLayer; it != lastLayer; ++it)
1190 availablePreferredBackends);
1193 for (
auto it = firstLayer; it != lastLayer; ++it)
1195 auto layer = PolymorphicDowncast<Layer*>(*it);
1199 BackendId connectedBackendId = layer->GetOutputSlot(0).GetConnection(0)->GetOwningLayer().GetBackendId();
1200 layer->SetBackendId(connectedBackendId);
1210 Optional<std::vector<std::string>&> errMessages)
1228 auto backendFactory = backendRegistry.GetFactory(selectedBackend);
1229 auto backendObjPtr = backendFactory();
1232 backendObjPtr->RegisterTensorHandleFactories(handleFactoryRegistry);
1234 backends[backendObjPtr->GetId()] = std::move(backendObjPtr);
1244 Optional<std::vector<std::string>&> errMessages)
1256 auto backendObjPtr = backends.find(selectedBackend)->second.get();
1269 [&backendObjPtr](
const Layer& layer)
1276 if (subgraphs.empty())
1283 for (
auto& subgraph : subgraphs)
1287 OptimizationViews optimizationViews = backendObjPtr->OptimizeSubgraphView(*subgraph, modelOptions);
1294 SubgraphView& replacementSubgraph = substitution.m_ReplacementSubgraph;
1295 SubgraphView& substitutableSubgraph = substitution.m_SubstitutableSubgraph;
1300 std::for_each(subgraphLayers.begin(), subgraphLayers.end(), [&selectedBackend](
IConnectableLayer* l)
1303 PolymorphicDowncast<Layer*>(l)->SetBackendId(selectedBackend);
1309 std::stringstream warningMsg;
1310 warningMsg <<
"Some sub-graph(s) failed to optimized on " << backendObjPtr->GetId() <<
" backend.";
1315 if (!backendObjPtr->GetId().IsCpuRef())
1325 std::stringstream subgraphMsg;
1326 subgraphMsg <<
"Re-assigning backends to " << failedSubgraph.GetIConnectableLayers().size()
1327 <<
" layers inside sub-graph " << count++;
1334 if (reassignmentResult.
m_Error)
1357 if (srcFactory && dstFactory &&
1383 if (frmBackend == backends.end() ||
1384 !frmBackend->second->SupportsTensorAllocatorAPI())
1391 std::map<ITensorHandleFactory::FactoryId, int> factoryScores;
1398 const Layer& connectedLayer = connection->GetOwningLayer();
1400 auto toBackend = backends.find(connectedLayer.
GetBackendId());
1401 ARMNN_ASSERT_MSG(toBackend != backends.end(),
"Backend id not found for the connected layer");
1403 if (!toBackend->second.get()->SupportsTensorAllocatorAPI())
1409 auto dstPrefs = toBackend->second.get()->GetHandleFactoryPreferences();
1410 for (
auto&& dst : dstPrefs)
1424 auto it = factoryScores.find(dst);
1425 if (it == factoryScores.end())
1428 factoryScores[dst] = 0;
1437 factoryScores[dst]++;
1440 if (factoryScores[dst] > topScore)
1442 topScore = factoryScores[dst];
1471 if (frmBackend == backends.end() ||
1472 !frmBackend->second->SupportsTensorAllocatorAPI())
1477 bool outputConnection =
false;
1480 const Layer& connectedLayer = connection->GetOwningLayer();
1483 outputConnection =
true;
1491 std::map<ITensorHandleFactory::FactoryId, int> factoryScores;
1492 for (
auto&& pref : srcPrefs)
1497 if (outputConnection)
1500 bool fallbackConnection =
false;
1503 if (inputSlot.GetConnectedOutputSlot()->GetOwningLayer().GetBackendId() != layer.
GetBackendId())
1505 fallbackConnection =
true;
1508 if (fallbackConnection)
1512 if (!factoryCap.empty())
1522 if (!outputConnection)
1526 if (!factoryCap.empty())
1545 auto it = factoryScores.find(pref);
1546 if (it == factoryScores.end())
1549 factoryScores[pref] = 0;
1556 const Layer& connectedLayer = connection->GetOwningLayer();
1558 auto toBackend = backends.find(connectedLayer.
GetBackendId());
1559 ARMNN_ASSERT_MSG(toBackend != backends.end(),
"Backend id not found for the connected layer");
1561 auto dstPrefs = toBackend->second.get()->GetHandleFactoryPreferences();
1562 for (
auto&& src : srcPrefs)
1564 if (factoryScores.find(src) == factoryScores.end())
1569 for (
auto&& dst : dstPrefs)
1574 factoryScores[src]++;
1582 int minScore = std::numeric_limits<int>::max();
1583 for (
auto it : factoryScores)
1585 minScore = std::min(minScore, it.second);
1589 std::vector<ITensorHandleFactory::FactoryId> optimalFactories;
1590 for (
auto it : factoryScores)
1592 if (it.second == minScore)
1594 optimalFactories.push_back(it.first);
1599 for (
auto&& srcPref : srcPrefs)
1601 for (
auto&& comp : optimalFactories)
1603 if (comp == srcPref)
1616 const Layer& connectedLayer,
1620 auto toBackend = backends.find(connectedLayer.
GetBackendId());
1621 ARMNN_ASSERT_MSG(toBackend != backends.end(),
"Backend id not found for the connected layer");
1623 auto dstPrefs = toBackend->second.get()->GetHandleFactoryPreferences();
1646 for (
auto&& pref : dstPrefs)
1648 if (pref == srcFactoryId)
1658 for (
auto&& pref : dstPrefs)
1677 if (srcCapability.empty() && dstCapability.empty() && srcFallback.empty() && dstFallback.empty())
1688 for (
auto&& pref : dstPrefs)
1707 Optional<std::vector<std::string>&> errMessages)
1712 optGraph.
ForEachLayer([&backends, ®istry, &result, &errMessages, importEnabled, exportEnabled](
Layer* layer)
1743 unsigned int connectionIdx = 0;
1746 const Layer& connectedLayer = connection->GetOwningLayer();
1749 registry, importEnabled);
1756 errMessages.value().emplace_back(
"Could not find valid strategy required for compatibility"
1757 " between backends.");
1774 const std::vector<BackendId>& backendPreferences,
1777 Optional<std::vector<std::string>&> messages)
1787 const std::vector<BackendId>& backendPreferences,
1790 Optional<std::vector<std::string>&> messages)
1800 if (backendPreferences.empty())
1808 "Please use the FastMathEnabled backend option for CpuAcc or GpuAcc.");
1819 std::unique_ptr<Graph> graph = std::make_unique<Graph>(inGraph);
1827 optimizedOptions.push_back(importExport);
1844 using namespace optimizations;
1894 std::stringstream failureMsg;
1895 failureMsg <<
"None of the preferred backends " << backendPreferences
1913 if (assignBackendsResult.
m_Error)
1928 if (backendOptimizationResult.
m_Error)
1953 #if !defined(ARMNN_DISABLE_FILESYSTEM)
1955 ARMNN_LOG(
info) <<
"Intermediate tensors will be written to: " << result;
1969 tensorHandleFactoryRegistry,
1991 const std::vector<BackendId>& backendPreferences,
1994 Optional<std::vector<std::string>&> messages)
2004 const std::vector<BackendId>& backendPreferences,
2007 Optional<std::vector<std::string>&> messages)
2016 bool NetworkImpl::GetShapeInferenceMethod()
2018 bool shapeInferenceMethod =
false;
2020 ParseOptions(m_NetworkOptions,
"ShapeInferenceMethod", [&](std::string name,
const BackendOptions::Var& value)
2022 if (name ==
"InferAndValidate")
2024 shapeInferenceMethod |= value.AsBool();
2027 return shapeInferenceMethod;
2030 bool NetworkImpl::GetAllowExpandedDims()
2032 bool allowExpandedDims =
false;
2034 ParseOptions(m_NetworkOptions,
"AllowExpandedDims", [&](std::string name,
const BackendOptions::Var& value)
2036 if (name ==
"AllowExpandedDims")
2038 allowExpandedDims |= value.AsBool();
2041 return allowExpandedDims;
2045 : m_NetworkOptions(networkOptions),
2046 m_Graph(
std::make_unique<
Graph>(GetShapeInferenceMethod(), GetAllowExpandedDims()))
2061 return m_Graph->AddLayer<
InputLayer>(id, name);
2072 return m_Graph->AddLayer<
CastLayer>(name);
2083 return m_Graph->AddLayer<
ComparisonLayer>(comparisonDescriptor, name);
2101 return m_Graph->AddLayer<
FillLayer>(fillDescriptor, name);
2113 return m_Graph->AddLayer<
ConcatLayer>(concatDescriptor, name);
2156 layer->
m_Anchors = std::make_shared<ScopedTensorHandle>(anchors);
2164 return m_Graph->AddLayer<
PermuteLayer>(permuteDescriptor, name);
2170 return m_Graph->AddLayer<
Pooling2dLayer>(pooling2dDescriptor, name);
2176 return m_Graph->AddLayer<
Pooling3dLayer>(pooling3dDescriptor, name);
2182 return m_Graph->AddLayer<
ActivationLayer>(activationDescriptor, name);
2188 return m_Graph->AddLayer<
ArgMinMaxLayer>(argMinMaxDescriptor, name);
2192 normalizationDescriptor,
2200 return m_Graph->AddLayer<
SliceLayer>(sliceDescriptor, name);
2206 return m_Graph->AddLayer<
SoftmaxLayer>(softmaxDescriptor, name);
2212 return m_Graph->AddLayer<
SplitterLayer>(splitterDescriptor, name);
2249 layer->
m_Mean = std::make_shared<ScopedTensorHandle>(mean);
2250 layer->m_Variance = std::make_shared<ScopedTensorHandle>(variance);
2251 layer->m_Beta = std::make_shared<ScopedTensorHandle>(beta);
2252 layer->m_Gamma = std::make_shared<ScopedTensorHandle>(gamma);
2259 return m_Graph->AddLayer<
RankLayer>(name);
2265 return m_Graph->AddLayer<
ReduceLayer>(reduceDescriptor, name);
2270 return m_Graph->AddLayer<
ResizeLayer>(resizeDescriptor, name);
2300 layer->
m_LayerOutput = std::make_shared<ScopedTensorHandle>(input);
2308 return m_Graph->AddLayer<
ReshapeLayer>(reshapeDescriptor, name);
2332 const auto layer = m_Graph->AddLayer<
LstmLayer>(descriptor, name);
2337 layer->m_BasicParameters.m_InputToCellWeights =
2339 layer->m_BasicParameters.m_InputToOutputWeights =
2341 layer->m_BasicParameters.m_RecurrentToForgetWeights =
2343 layer->m_BasicParameters.m_RecurrentToCellWeights =
2345 layer->m_BasicParameters.m_RecurrentToOutputWeights =
2347 layer->m_BasicParameters.m_ForgetGateBias =
2349 layer->m_BasicParameters.m_CellBias =
2350 std::make_shared<ScopedTensorHandle>(*(params.
m_CellBias));
2351 layer->m_BasicParameters.m_OutputGateBias =
2355 if(!descriptor.m_CifgEnabled)
2360 "when CIFG is disabled.");
2365 "AddLstmLayer: Recurrent To Input Weights cannot be NULL "
2366 "when CIFG is disabled.");
2371 "when CIFG is disabled.");
2373 layer->m_CifgParameters.m_InputToInputWeights =
2375 layer->m_CifgParameters.m_RecurrentToInputWeights =
2377 layer->m_CifgParameters.m_InputGateBias =
2382 if(descriptor.m_ProjectionEnabled)
2387 "when projection is enabled.");
2389 layer->m_ProjectionParameters.m_ProjectionWeights =
2393 layer->m_ProjectionParameters.m_ProjectionBias =
2399 if(descriptor.m_PeepholeEnabled)
2401 if(!descriptor.m_CifgEnabled)
2406 "when Peephole is enabled and CIFG disabled.");
2409 layer->m_PeepholeParameters.m_CellToInputWeights =
2416 "when Peephole is enabled.");
2421 "when Peephole is enabled.");
2424 layer->m_PeepholeParameters.m_CellToForgetWeights =
2426 layer->m_PeepholeParameters.m_CellToOutputWeights =
2431 if(descriptor.m_LayerNormEnabled)
2433 if(!descriptor.m_CifgEnabled)
2438 "when layer normalization is enabled and CIFG disabled.");
2440 layer->m_LayerNormParameters.m_InputLayerNormWeights =
2447 "when layer normalization is enabled.");
2452 "when layer normalization is enabled.");
2457 "when layer normalization is enabled.");
2459 layer->m_LayerNormParameters.m_ForgetLayerNormWeights =
2461 layer->m_LayerNormParameters.m_CellLayerNormWeights =
2463 layer->m_LayerNormParameters.m_OutputLayerNormWeights =
2481 return m_Graph->AddLayer<
MeanLayer>(meanDescriptor,name);
2486 return m_Graph->AddLayer<
PadLayer>(padDescriptor,name);
2508 return m_Graph->AddLayer<
GatherLayer>(gatherDescriptor, name);
2543 layer->
m_Weight = std::make_shared<ScopedTensorHandle>(weights);
2545 if (descriptor.m_BiasEnabled)
2547 layer->m_Bias = std::make_shared<ScopedTensorHandle>(biases.
value());
2556 return m_Graph->AddLayer<
TransposeLayer>(transposeDescriptor, name);
2562 return m_Graph->AddLayer<
StackLayer>(stackDescriptor, name);
2580 layer->m_QuantizedLstmParameters.m_InputToForgetWeights =
2582 layer->m_QuantizedLstmParameters.m_InputToCellWeights =
2584 layer->m_QuantizedLstmParameters.m_InputToOutputWeights =
2588 layer->m_QuantizedLstmParameters.m_RecurrentToInputWeights =
2590 layer->m_QuantizedLstmParameters.m_RecurrentToForgetWeights =
2592 layer->m_QuantizedLstmParameters.m_RecurrentToCellWeights =
2594 layer->m_QuantizedLstmParameters.m_RecurrentToOutputWeights =
2598 layer->m_QuantizedLstmParameters.m_InputGateBias =
2600 layer->m_QuantizedLstmParameters.m_ForgetGateBias =
2602 layer->m_QuantizedLstmParameters.m_CellBias =
2603 std::make_shared<ScopedTensorHandle>(params.
GetCellBias());
2604 layer->m_QuantizedLstmParameters.m_OutputGateBias =
2614 const auto layer = m_Graph->AddLayer<
QLstmLayer>(descriptor, name);
2619 layer->m_BasicParameters.m_InputToCellWeights =
2621 layer->m_BasicParameters.m_InputToOutputWeights =
2623 layer->m_BasicParameters.m_RecurrentToForgetWeights =
2625 layer->m_BasicParameters.m_RecurrentToCellWeights =
2627 layer->m_BasicParameters.m_RecurrentToOutputWeights =
2629 layer->m_BasicParameters.m_ForgetGateBias =
2631 layer->m_BasicParameters.m_CellBias =
2632 std::make_shared<ScopedTensorHandle>(*(params.
m_CellBias));
2633 layer->m_BasicParameters.m_OutputGateBias =
2637 if(!descriptor.m_CifgEnabled)
2647 "AddQLstmLayer: Recurrent To Input Weights cannot be NULL");
2655 layer->m_CifgParameters.m_InputToInputWeights =
2657 layer->m_CifgParameters.m_RecurrentToInputWeights =
2659 layer->m_CifgParameters.m_InputGateBias =
2664 if(descriptor.m_ProjectionEnabled)
2671 layer->m_ProjectionParameters.m_ProjectionWeights =
2677 layer->m_ProjectionParameters.m_ProjectionBias =
2684 if(descriptor.m_PeepholeEnabled)
2696 if(!descriptor.m_CifgEnabled)
2703 layer->m_PeepholeParameters.m_CellToInputWeights =
2707 layer->m_PeepholeParameters.m_CellToForgetWeights =
2709 layer->m_PeepholeParameters.m_CellToOutputWeights =
2714 if(descriptor.m_LayerNormEnabled)
2731 if(!descriptor.m_CifgEnabled)
2738 layer->m_LayerNormParameters.m_InputLayerNormWeights =
2742 layer->m_LayerNormParameters.m_ForgetLayerNormWeights =
2744 layer->m_LayerNormParameters.m_CellLayerNormWeights =
2746 layer->m_LayerNormParameters.m_OutputLayerNormWeights =
2768 layer->m_BasicParameters.m_InputToCellWeights =
2770 layer->m_BasicParameters.m_InputToOutputWeights =
2772 layer->m_BasicParameters.m_RecurrentToForgetWeights =
2774 layer->m_BasicParameters.m_RecurrentToCellWeights =
2776 layer->m_BasicParameters.m_RecurrentToOutputWeights =
2778 layer->m_BasicParameters.m_ForgetGateBias =
2780 layer->m_BasicParameters.m_CellBias =
2781 std::make_shared<ScopedTensorHandle>(*(params.
m_CellBias));
2782 layer->m_BasicParameters.m_OutputGateBias =
2786 if(!descriptor.m_CifgEnabled)
2791 "when CIFG is disabled.");
2796 "AddUnidirectionalSequenceLstmLayer: Recurrent To Input Weights cannot be NULL "
2797 "when CIFG is disabled.");
2802 "when CIFG is disabled.");
2804 layer->m_CifgParameters.m_InputToInputWeights =
2806 layer->m_CifgParameters.m_RecurrentToInputWeights =
2808 layer->m_CifgParameters.m_InputGateBias =
2813 if(descriptor.m_ProjectionEnabled)
2818 "when projection is enabled.");
2820 layer->m_ProjectionParameters.m_ProjectionWeights =
2824 layer->m_ProjectionParameters.m_ProjectionBias =
2830 if(descriptor.m_PeepholeEnabled)
2832 if(!descriptor.m_CifgEnabled)
2837 "cannot be NULL when Peephole is enabled and CIFG disabled.");
2840 layer->m_PeepholeParameters.m_CellToInputWeights =
2847 "when Peephole is enabled.");
2852 "when Peephole is enabled.");
2855 layer->m_PeepholeParameters.m_CellToForgetWeights =
2857 layer->m_PeepholeParameters.m_CellToOutputWeights =
2862 if(descriptor.m_LayerNormEnabled)
2864 if(!descriptor.m_CifgEnabled)
2869 "cannot be NULL when layer normalization is enabled and CIFG disabled.");
2871 layer->m_LayerNormParameters.m_InputLayerNormWeights =
2878 "cannot be NULL when layer normalization is enabled.");
2883 "cannot be NULL when layer normalization is enabled.");
2888 "cannot be NULL when layer normalization is enabled.");
2890 layer->m_LayerNormParameters.m_ForgetLayerNormWeights =
2892 layer->m_LayerNormParameters.m_CellLayerNormWeights =
2894 layer->m_LayerNormParameters.m_OutputLayerNormWeights =
2918 layer = m_Graph->AddLayer<
PreCompiledLayer>(preCompiledDescriptor,
"pre-compiled");
2942 layer->ExecuteStrategy(strategy);
2947 : m_Graph(new
Graph(*other.m_Graph.get()))
2948 , m_Guid(
arm::pipe::IProfilingService::GetNextGuid())
2949 , m_ModelOptions(modelOptions)
2954 : m_Graph(
std::move(graph)), m_Guid(
arm::pipe::IProfilingService::GetNextGuid())
2959 : m_Graph(
std::move(graph)), m_Guid(
arm::pipe::IProfilingService::GetNextGuid()), m_ModelOptions(modelOptions)
2976 layer->ExecuteStrategy(strategy);
OptimizeForType< Layer, AddDebugToFileImpl > InsertDebugToFileLayer
IConnectableLayer * AddConvolution2dLayer(const Convolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
Adds a 2D convolution layer to the network.
OptimizeForConnection< ConvertFp16ToFp32Layer, ConvertFp32ToFp16Layer, OptimizeInverseConversionsImpl > OptimizeInverseConversionsFp16
std::shared_ptr< ConstTensorHandle > m_Mean
A unique pointer to store Mean values.
OptimizationResult SelectTensorHandleStrategy(Graph &optGraph, BackendsMap &backends, TensorHandleFactoryRegistry ®istry, bool importEnabled, bool exportEnabled, Optional< std::vector< std::string > & > errMessages)
IConnectableLayer * AddMergeLayer(const char *name=nullptr)
IConnectableLayer * AddDepthwiseConvolution2dLayer(const DepthwiseConvolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
Adds a 2D depthwise convolution layer to the network.
IConnectableLayer * AddPrecompiledLayer(const PreCompiledDescriptor &preCompiledDescriptor, CompiledBlobPtr compiledBlobPtr, const Optional< BackendId > &backend, const char *name=nullptr)
const std::shared_ptr< IProfiler > & GetProfiler() const
bool GetDebugEnabled() const
IConnectableLayer * AddResizeLayer(const ResizeDescriptor &resizeDescriptor, const char *name=nullptr)
IConnectableLayer * AddQuantizedLstmLayer(const QuantizedLstmInputParams ¶ms, const char *name=nullptr)
IConnectableLayer * AddElementwiseUnaryLayer(const ElementwiseUnaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr)
This layer represents a elementwiseBinary operation.
void SetTensorHandleFactory(const ITensorHandleFactory::FactoryId &id)
const std::shared_ptr< IProfiler > & GetProfiler() const
LayerList::const_iterator Iterator
@ DirectCompatibility
No strategy has been defined. Used internally to verify integrity of optimizations.
This layer represents a ArgMinMax operation.
BackendRegistry & BackendRegistryInstance()
IConnectableLayer * AddDepthToSpaceLayer(const DepthToSpaceDescriptor &depthToSpaceDescriptor, const char *name=nullptr)
OptimizedNetworkImpl(const OptimizedNetworkImpl &other, const ModelOptions &modelOptions)
IConnectableLayer * AddNormalizationLayer(const NormalizationDescriptor &normalizationDescriptor, const char *name=nullptr)
OptimizeForExclusiveConnection< PadLayer, Convolution2dLayer, pad_fold::FoldPadIntoConvolution2dImpl > FoldPadIntoConvolution2d
unsigned int GetNumOutputSlots() const override
Returns the number of connectable output slots.
IConnectableLayer * AddFloorLayer(const char *name=nullptr)
Adds a floor layer to the network.
IConnectableLayer * AddBatchToSpaceNdLayer(const BatchToSpaceNdDescriptor &batchToSpaceNdDescriptor, const char *name=nullptr)
A layer that the constant data can be bound to.
A GatherDescriptor for the GatherLayer.
A NormalizationDescriptor for the NormalizationLayer.
void SetDataType(DataType type)
static const FactoryId DeferredFactoryId
Use the workload factory to create the tensor handle.
A TransposeDescriptor for the TransposeLayer.
const std::string & Get() const
bool GetDebugToFileEnabled() const
std::vector< SubgraphView::SubgraphViewPtr > Subgraphs
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...
OptimizeForConnection< ConstantLayer, PermuteLayer, ConvertConstPermuteLayersToConstLayers > FusePermuteIntoConstLayer
std::vector< ConvertFp32ToFp16Layer * > InsertConvertFp32ToFp16LayersAfter(Graph &graph, Layer &layer)
void ExecuteStrategy(IStrategy &strategy) const
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.
This layer represents a batch normalization operation.
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
A ElementwiseUnaryDescriptor for the ElementwiseUnaryLayer.
IConnectableLayer * AddPooling2dLayer(const Pooling2dDescriptor &pooling2dDescriptor, const char *name=nullptr)
A PadDescriptor for the PadLayer.
A SoftmaxDescriptor for the SoftmaxLayer.
static Subgraphs SelectSubgraphs(Graph &graph, const LayerSelectorFunction &selector)
Selects subgraphs from a graph based on the selector function and the algorithm.
IConnectableLayer * AddConvolution2dLayer(const Convolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
std::unique_ptr< NetworkImpl > pNetworkImpl
OptimizeForConnection< Layer, TransposeLayer, MoveTransposeUpImpl > MoveTransposeUp
BackendIdVector m_PreferredBackends
bool m_AllowExpandedDims
When calculating tensor sizes, dimensions of size == 1 will be ignored.
A StackDescriptor for the StackLayer.
IConnectableLayer * AddPooling3dLayer(const Pooling3dDescriptor &pooling3dDescriptor, const char *name=nullptr)
Adds a 3D pooling layer to the network.
This layer represents a fill operation.
A SliceDescriptor for the SliceLayer.
IConnectableLayer * AddDivisionLayer(const char *name=nullptr)
Adds a division layer to the network.
Status SerializeToDot(std::ostream &stream) const
BackendIdVector GetAvailablePreferredBackends() const
bool m_ExportEnabled
Enable Export.
bool m_ReduceFp32ToFp16
Reduces all Fp32 operators in the model to Fp16 for faster processing.
static INetwork * CreateRaw(const NetworkOptions &networkOptions={})
static void Pass(Graph &graph, const Optimizations &optimizations)
OptimizationResult ReturnWithError(OptimizationResult res, const Layer *layer, const BackendSettings &backendSettings, Optional< std::vector< std::string > & > errMessages)
std::string CreateDirectory(std::string sPath)
Returns full path to temporary folder.
IConnectableLayer * AddQLstmLayer(const QLstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
Add a QLstm layer to the network.
IConnectableLayer * AddLogSoftmaxLayer(const LogSoftmaxDescriptor &logSoftmaxDescriptor, const char *name=nullptr)
Adds a log softmax layer to the network.
std::map< BackendId, std::unique_ptr< class IBackendInternal > > BackendsMap
int LayerBindingId
Type of identifiers for bindable layers (inputs, outputs).
static const FactoryId LegacyFactoryId
An ActivationDescriptor for the ActivationLayer.
@ ValidateOnly
Validate all output shapes.
IConnectableLayer * AddInstanceNormalizationLayer(const InstanceNormalizationDescriptor &desc, const char *name=nullptr)
OptimizeForConnection< ConvertFp32ToFp16Layer, ConvertFp16ToFp32Layer, OptimizeInverseConversionsImpl > OptimizeInverseConversionsFp32
virtual bool SupportsMapUnmap() const
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
IConnectableLayer * AddRankLayer(const char *name=nullptr)
An LstmDescriptor for the LstmLayer.
This layer represents a split operation.
This layer represents a SpaceToBatchNd operation.
A FullyConnectedDescriptor for the FullyConnectedLayer.
void SetTensorInfo(const TensorInfo &tensorInfo) override
ModelOptions m_ModelOptions
Enable Model Options.
ITensorHandleFactory::FactoryId CalculateSlotOptionForOutput(BackendsMap &backends, OutputSlot &slot, TensorHandleFactoryRegistry ®istry)
virtual MemorySourceFlags GetImportFlags() const
IConnectableLayer * AddMeanLayer(const MeanDescriptor &meanDescriptor, const char *name=nullptr)
void ParseOptions(const std::vector< BackendOptions > &options, BackendId backend, F f)
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 > & > errMessages)
void SetBackendId(const BackendId &id) override
Set the backend of the IConnectableLayer.
IConnectableLayer * AddGatherNdLayer(const char *name=nullptr)
armnn::ShapeInferenceMethod GetShapeInferenceMethod() const
IConnectableLayerIterator beginIConnectable()
OptimizationResult ApplyBackendOptimizations(OptimizedNetworkImpl *optNetObjPtr, BackendSettings &backendSettings, BackendsMap &backends, const ModelOptions &modelOptions, Optional< std::vector< std::string > & > errMessages)
IConnectableLayer * AddDetectionPostProcessLayer(const DetectionPostProcessDescriptor &descriptor, const ConstTensor &anchors, const char *name=nullptr)
Adds a Detection PostProcess layer to the network.
IConnectableLayer * AddSubtractionLayer(const char *name=nullptr)
Adds a subtraction layer to the network.
BackendIdSet m_SelectedBackends
A BatchMatMulDescriptor for the BatchMatMul operator.
This layer represents a QLstm operation.
@ CpuAcc
CPU Execution: NEON: ArmCompute.
This layer represents a transpose operation.
@ GpuAcc
GPU Execution: OpenCL: ArmCompute.
A ResizeDescriptor for the ResizeLayer.
IConnectableLayer * AddSliceLayer(const SliceDescriptor &sliceDescriptor, const char *name=nullptr)
Adds a slice layer to the network.
IConnectableLayer * AddMinimumLayer(const char *name=nullptr)
A StridedSliceDescriptor for the StridedSliceLayer.
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
OptimizeForConnection< TransposeLayer, TransposeLayer, OptimizeInversePermutesImpl< TransposeLayer > > OptimizeInverseTransposes
This layer represents a merge operation.
A Pooling3dDescriptor for the Pooling3dLayer.
A ReduceDescriptor for the REDUCE operators.
bool m_BiasEnabled
Enable/disable bias.
Struct for the users to pass backend specific options.
IConnectableLayers::iterator IConnectableLayerIterator
This layer represents a multiplication operation.
This layer represents a GatherNd operator.
bool GetAllowExpandedDims() const
std::vector< BackendOptions > ModelOptions
OptimizeForConnection< Layer, ReshapeLayer, SquashEqualSiblingsImpl< ReshapeLayer > > SquashEqualReshapeSiblings
A ComparisonDescriptor for the ComparisonLayer.
void IgnoreUnused(Ts &&...)
IConnectableLayer * AddGatherLayer(const GatherDescriptor &gatherDescriptor, const char *name=nullptr)
IConnectableLayer * AddBatchMatMulLayer(const BatchMatMulDescriptor &desc, const char *name=nullptr)
A StandInDescriptor for the StandIn layer.
QuantizedLstmParameters m_QuantizedLstmParameters
std::list< IConnectableLayer * > IConnectableLayers
IConnectableLayer * AddElementwiseBinaryLayer(const ElementwiseBinaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr)
Add an ElementwiseBinary layer to the network.
This layer represents a LSTM operation.
IConnectableLayer * AddQuantizeLayer(const char *name=nullptr)
Add a quantize layer to the network.
IConnectableLayer * AddMinimumLayer(const char *name=nullptr)
Add a Minimum layer to the network.
virtual const char * what() const noexcept override
IConnectableLayer * AddMultiplicationLayer(const char *name=nullptr)
A ViewsDescriptor for the SplitterLayer.
IConnectableLayer * AddAdditionLayer(const char *name=nullptr)
IConnectableLayer * AddLogSoftmaxLayer(const LogSoftmaxDescriptor &logSoftmaxDescriptor, const char *name=nullptr)
IConnectableLayer * AddChannelShuffleLayer(const ChannelShuffleDescriptor &channelShuffleDescriptor, const char *name=nullptr)
Iterator begin()
Returns iterator pointing to the beginning of the list. Lowercase for range-based for loops.
IConnectableLayer * AddStridedSliceLayer(const StridedSliceDescriptor &stridedSliceDescriptor, const char *name=nullptr)
OptimizeForType< Layer, AddBroadcastReshapeLayerImpl > AddBroadcastReshapeLayer
A PreCompiledDescriptor for the PreCompiledLayer.
virtual Status SerializeToDot(std::ostream &stream) const
BackendsMap CreateSupportedBackends(TensorHandleFactoryRegistry &handleFactoryRegistry, BackendSettings &backendSettings)
void SetShapeInferenceMethod(armnn::ShapeInferenceMethod ShapeInferenceMethodType)
void VerifyConstantLayerSetTensorInfo() const
For each ConstantLayer in Graph, ensures TensorInfo is set on all output slots.
IConnectableLayer * AddPooling2dLayer(const Pooling2dDescriptor &pooling2dDescriptor, const char *name=nullptr)
Adds a 2D pooling layer to the network.
This layer represents an activation operation with the specified activation function.
This layer dequantizes the input tensor.
ShapeInferenceMethod
The ShapeInferenceMethod modify how the output shapes are treated.
Optimizer::Optimizations MakeOptimizations(Args &&... args)
This layer represents a permutation operation.
OptimizeForConnection< Layer, PermuteLayer, MovePermuteUpImpl > MovePermuteUp
void SetImportEnabled(bool ImportState)
This layer represents a Logical Binary operation.
This layer represents a reshape operation.
const IConnectableLayers & GetIConnectableLayers() const
bool RequiresCopy(ITensorHandleFactory::FactoryId src, ITensorHandleFactory::FactoryId dst, TensorHandleFactoryRegistry ®istry)
IConnectableLayer * AddBatchMatMulLayer(const BatchMatMulDescriptor &descriptor, const char *name=nullptr)
Add a BatchMatMul layer to the network.
#define ARMNN_LOG(severity)
size_t GetNumOutputs() const
IConnectableLayer * AddDepthwiseConvolution2dLayer(const DepthwiseConvolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
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.
This layer represents a log softmax operation.
IConnectableLayer * AddActivationLayer(const ActivationDescriptor &activationDescriptor, const char *name=nullptr)
void SetAllowExpandedDims(bool ExpandedDimsAllowed)
IConnectableLayer * AddReduceLayer(const ReduceDescriptor &reduceDescriptor, const char *name=nullptr)
Adds a reduce layer to the network.
This layer represents a detection postprocess operator.
IConnectableLayer * AddConstantLayer(const ConstTensor &input, const char *name=nullptr)
IConnectableLayer * AddDequantizeLayer(const char *name=nullptr)
Adds a Dequantize layer to the network.
static void Destroy(INetwork *network)
IConnectableLayer * AddConvertFp32ToFp16Layer(const char *name=nullptr)
Copyright (c) 2021 ARM Limited and Contributors.
virtual std::vector< Capability > GetCapabilities(const IConnectableLayer *layer, const IConnectableLayer *connectedLayer, CapabilityClass capabilityClass)
IConnectableLayer * AddMaximumLayer(const char *name=nullptr)
Add a Maximum layer to the network.
IConnectableLayerIterator endIConnectable()
bool GetReduceFp32ToFp16() const
IConnectableLayer * AddStackLayer(const StackDescriptor &descriptor, const char *name=nullptr)
Adds a stack layer to the network.
ConvertConstants< Float32ToFloat16, IsFloat16Layer > ConvertConstantsFloatToHalf
INetwork(NetworkOptions networkOptions={})
std::string GetName() const
void ReportWarning(const std::string &warningMessage, Optional< std::vector< std::string > & > warningMessages)
const TensorInfo & GetTensorInfo() const override
A BatchToSpaceNdDescriptor for the BatchToSpaceNdLayer.
IConnectableLayer * AddPrecompiledLayer(const PreCompiledDescriptor &preCompiledDescriptor, CompiledBlobPtr compiledBlobPtr, const Optional< BackendId > &backend, const char *name=nullptr)
Adds a Precompiled layer to the network.
This layer represents a 2D transpose convolution operation.
A SpaceToDepthDescriptor for the SpaceToDepthLayer.
IConnectableLayer * AddMultiplicationLayer(const char *name=nullptr)
Adds a multiplication layer to the network.
OptimizeForConnection< Layer, TransposeLayer, SquashEqualSiblingsImpl< TransposeLayer > > SquashEqualTransposeSiblings
IConnectableLayer * AddDivisionLayer(const char *name=nullptr)
~OptimizerOptionsOpaque()
std::shared_ptr< ConstTensorHandle > m_Weight
A unique pointer to store weight values.
This layer calculates both true and false outputs for input.
void SubstituteSubgraph(SubgraphView &subgraph, IConnectableLayer *substituteLayer)
Substitutes the given sub-graph with either a new layer or a new sub-graph.
std::vector< BackendOptions > NetworkOptions
This layer represents a Gather operator.
IConnectableLayer * AddNormalizationLayer(const NormalizationDescriptor &normalizationDescriptor, const char *name=nullptr)
Adds a normalization layer to the network.
std::vector< DataType > GetLayerInOutDatatype(const Layer *layer)
IConnectableLayer * AddOutputLayer(LayerBindingId id, const char *name=nullptr)
bool m_ProfilingEnabled
Enable profiling dump of the optimizer phase.
IConnectableLayer * AddSpaceToDepthLayer(const SpaceToDepthDescriptor &spaceToDepthDescriptor, const char *name=nullptr)
const std::string & GetNameStr() const
This layer dequantizes the input tensor.
IConnectableLayer * AddElementwiseBinaryLayer(const ElementwiseBinaryDescriptor &elementwiseBinaryDescriptor, const char *name=nullptr)
IConnectableLayer * AddSpaceToBatchNdLayer(const SpaceToBatchNdDescriptor &spaceToBatchNdDescriptor, const char *name=nullptr)
Adds a space to batch layer to the network.
Iterator end()
Returns iterator pointing to the end of the list. Lowercase for range-based for loops.
void SetEdgeStrategy(unsigned int connectionIndex, EdgeStrategy strategy)
A FillDescriptor for the FillLayer.
IConnectableLayer * AddConvolution3dLayer(const Convolution3dDescriptor &convolution3dDescriptor, const char *name=nullptr)
Adds a 3D convolution layer to the network.
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
IConnectableLayer * AddConvertFp16ToFp32Layer(const char *name=nullptr)
unsigned int GetNumInputSlots() const override
Returns the number of connectable input slots.
bool Validate(const SubgraphView &originalSubgraph) const
std::shared_ptr< ConstTensorHandle > m_Anchors
A unique pointer to store Anchor values.
IConnectableLayer * AddL2NormalizationLayer(const L2NormalizationDescriptor &desc, const char *name=nullptr)
Adds an L2 normalization layer to the network.
IConnectableLayer * AddSubtractionLayer(const char *name=nullptr)
IConnectableLayer * AddDetectionPostProcessLayer(const DetectionPostProcessDescriptor &descriptor, const ConstTensor &anchors, const char *name=nullptr)
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
bool IsCpuRefUsed() const
void SetReduceFp32ToFp16(bool ReduceFp32ToFp16State)
virtual std::vector< ITensorHandleFactory::FactoryId > GetHandleFactoryPreferences() const
(Optional) Returns a vector of supported TensorHandleFactory ids in preference order.
IConnectableLayer * AddFloorLayer(const char *name=nullptr)
IConnectableLayer * AddTransposeLayer(const TransposeDescriptor &transposeDescriptor, const char *name=nullptr)
Adds a transpose 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.
This layer represents a subtraction operation.
IConnectableLayer * AddAdditionLayer(const char *name=nullptr)
Adds an addition layer to the network.
bool GetProfilingEnabled() const
This layer represents a normalization operation.
IConnectableLayer * AddPadLayer(const PadDescriptor &padDescriptor, const char *name=nullptr)
Adds a fully pad layer to the network.
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
A MeanDescriptor for the MeanLayer.
std::shared_ptr< ConstTensorHandle > m_InputToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [outputSize, inputSize] (QAsymm8).
IConnectableLayer * AddInstanceNormalizationLayer(const InstanceNormalizationDescriptor &desc, const char *name=nullptr)
Adds an instance normalization layer to the network.
IConnectableLayer * AddPermuteLayer(const PermuteDescriptor &permuteDescriptor, const char *name=nullptr)
IConnectableLayer * AddPooling3dLayer(const Pooling3dDescriptor &pooling3dDescriptor, const char *name=nullptr)
bool m_DebugToFile
Pass debug data to separate output files for easier troubleshooting.
void SetDebugEnabled(bool DebugState)
This layer represents a strided slice operation.
const std::vector< InputSlot * > & GetConnections() const
Device specific knowledge to be passed to the optimizer.
arm::pipe::ProfilingGuid GetGuid() const
LayerType GetType() const override
Returns the armnn::LayerType of this layer.
static void Destroy(IOptimizedNetwork *network)
IConnectableLayer * AddInputLayer(LayerBindingId id, const char *name=nullptr)
IConnectableLayer * AddMergeLayer(const char *name=nullptr)
Adds a merge layer to the network.
std::unique_ptr< void, CompiledBlobDeleter > CompiledBlobPtr
IConnectableLayer * AddConcatLayer(const ConcatDescriptor &concatDescriptor, const char *name=nullptr)
void ReportError(const std::string &errorMessage, Optional< std::vector< std::string > & > errorMessages)
std::unique_ptr< OptimizedNetworkImpl > pOptimizedNetworkImpl
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
The SubgraphView class represents a subgraph of a Graph.
A L2NormalizationDescriptor for the L2NormalizationLayer.
IConnectableLayer * AddPermuteLayer(const PermuteDescriptor &permuteDescriptor, const char *name=nullptr)
Adds a permute layer to the network.
static bool IsLayerSupported(const BackendId &backendId, const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported)
LstmBasicParameters m_BasicParameters
This layer represents a QuantizedLstm operation.
A ChannelShuffleDescriptor for the ChannelShuffle operator.
A Convolution3dDescriptor for the Convolution3dLayer.
This layer represents a BatchToSpaceNd operation.
OptimizeForType< Layer, ConvertFp32NetworkToFp16Impl > Fp32NetworkToFp16Converter
static ProfilerManager & GetInstance()
A Convolution2dDescriptor for the Convolution2dLayer.
IConnectableLayer * AddComparisonLayer(const ComparisonDescriptor &comparisonDescriptor, const char *name=nullptr)
Add a Comparison layer to the network.
IConnectableLayer * AddStandInLayer(const StandInDescriptor &descriptor, const char *name=nullptr)
const BackendId & GetBackendId() 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,...
IConnectableLayer * AddQLstmLayer(const QLstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
IOptimizedNetwork(const IOptimizedNetwork &other, const ModelOptions &modelOptions)
Creates a copy of the IOptimizedNetwork.
This layer represents an instance normalization operation.
IConnectableLayer * AddCastLayer(const char *name=nullptr)
Adds a cast layer to the network.
A BatchNormalizationDescriptor for the BatchNormalizationLayer.
void SetDebugToFileEnabled(bool DebugFileState)
This layer represents a cast operation.
OptimizeForType< Layer, AddDebugImpl > InsertDebugLayer
A QLstmDescriptor for the QLstmLayer.
QLstmBasicParameters m_BasicParameters
BackendIdSet m_IgnoredBackends
bool has_value() const noexcept
This layer represents a softmax operation.
OptimizeForExclusiveConnection< DepthwiseConvolution2dLayer, BatchNormalizationLayer, FuseBatchNorm< DepthwiseConvolution2dLayer, armnn::DataType::Float16 > > FuseBatchNormIntoDepthwiseConvolution2DFloat16
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
bool m_ReduceFp32ToBf16
@Note This feature has been replaced by enabling Fast Math in compute library backend options.
OptimizeForType< TransposeLayer, TransposeAsReshapeImpl > TransposeAsReshape
void SetPreCompiledObject(PreCompiledObjectPtr preCompiledObject)
void ExecuteStrategy(IStrategy &strategy) const
ShapeInferenceMethod m_shapeInferenceMethod
Infer output size when not available.
This layer represents a reduction operation.
OptimizerOptionsOpaque & operator=(OptimizerOptionsOpaque other)
IConnectableLayer * AddTransposeConvolution2dLayer(const TransposeConvolution2dDescriptor &descriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr)
IConnectableLayer * AddFillLayer(const FillDescriptor &fillDescriptor, const char *name=nullptr)
Layer & GetOwningLayer() const
IConnectableLayer * AddActivationLayer(const ActivationDescriptor &activationDescriptor, const char *name=nullptr)
Adds an activation layer to the network.
IConnectableLayer * AddGatherNdLayer(const char *name=nullptr)
Add GatherNd layer to the network.
ITensorHandleFactory * GetFactory(ITensorHandleFactory::FactoryId id) const
Find a TensorHandleFactory by Id Returns nullptr if not found.
This layer represents a fully connected operation.
IConnectableLayer * AddPreluLayer(const char *name=nullptr)
const std::vector< InputSlot > & GetInputSlots() const
std::shared_ptr< ConstTensorHandle > m_LayerOutput
#define ARMNN_ASSERT_MSG(COND, MSG)
This layer represents a pad operation.
virtual Status PrintGraph()
size_t GetNumInputs() const
bool GetImportEnabled() const
IConnectableLayer * AddChannelShuffleLayer(const ChannelShuffleDescriptor &descriptor, const char *name=nullptr)
Add a ChannelShuffle layer to the network.
IConnectableLayer * AddGatherLayer(const GatherDescriptor &descriptor, const char *name=nullptr)
Add Gather layer to the network.
This layer represents a pooling 3d operation.
const Subgraphs & GetFailedSubgraphs() const
This layer represents a pooling 2d operation.
IConnectableLayer * AddComparisonLayer(const ComparisonDescriptor &comparisonDescriptor, const char *name=nullptr)
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
static INetworkPtr Create(const NetworkOptions &networkOptions={})
#define ARMNN_NO_DEPRECATE_WARN_BEGIN
IConnectableLayer * AddCastLayer(const char *name=nullptr)
IConnectableLayer * AddArgMinMaxLayer(const ArgMinMaxDescriptor &desc, const char *name=nullptr)
IConnectableLayer * AddDepthToSpaceLayer(const DepthToSpaceDescriptor &depthToSpaceDescriptor, const char *name=nullptr)
Adds a depth to space layer to the network.
An OriginsDescriptor for the ConcatLayer.
IConnectableLayer * AddDequantizeLayer(const char *name=nullptr)
bool GetExportEnabled() const
A ReshapeDescriptor for the ReshapeLayer.
void ForEachLayer(Func func) const
IConnectableLayer * AddL2NormalizationLayer(const L2NormalizationDescriptor &desc, const char *name=nullptr)
EdgeStrategy CalculateEdgeStrategy(BackendsMap &backends, ITensorHandleFactory::FactoryId srcFactoryId, const Layer &layer, const Layer &connectedLayer, TensorHandleFactoryRegistry ®istry, bool importEnabled)
IConnectableLayer * AddPreluLayer(const char *name=nullptr)
Adds a PReLU layer to the network.
OptimizeForExclusiveConnection< PadLayer, DepthwiseConvolution2dLayer, pad_fold::FoldPadIntoDepthwiseConvolution2dImpl > FoldPadIntoDepthwiseConvolution2d
const std::string ToString() const
IConnectableLayer * AddConvolution3dLayer(const Convolution3dDescriptor &convolution3dDescriptor, const char *name=nullptr)
This layer represents a depthwise convolution 2d operation.
A PermuteDescriptor for the PermuteLayer.
A TransposeConvolution2dDescriptor for the TransposeConvolution2dLayer.
IConnectableLayer * AddSpaceToDepthLayer(const SpaceToDepthDescriptor &spaceToDepthDescriptor, const char *name=nullptr)
Adds a space to depth layer to the network.
void AssignBackendsIConnectable(OptimizedNetworkImpl *optNetObjPtr, IConnectableLayer *it, Optional< std::vector< std::string > & > errMessages, OptimizationResult &result, BackendSettings &backendSettings, std::vector< BackendId > &availablePreferredBackends)
IConnectableLayer * AddSwitchLayer(const char *name=nullptr)
Adds a switch layer to the network.
const Graph & GetGraph() const
IConnectableLayer * AddSwitchLayer(const char *name=nullptr)
OptimizeForConnection< PermuteLayer, BatchToSpaceNdLayer, PermuteAndBatchToSpaceAsDepthToSpaceImpl< PermuteLayer > > PermuteAndBatchToSpaceAsDepthToSpace
Optional< BackendId > GetBackendHint() const
This layer represents a L2 normalization operation.
#define ARMNN_ASSERT(COND)
IConnectableLayer * AddMeanLayer(const MeanDescriptor &meanDescriptor, const char *name=nullptr)
Add a Mean layer to the network.
BackendIdSet m_SupportedBackends
IConnectableLayer * AddLogicalBinaryLayer(const LogicalBinaryDescriptor &logicalBinaryDescriptor, const char *name=nullptr)
void ExecuteStrategy(IStrategy &strategy) const
IConnectableLayer * AddShapeLayer(const char *name=nullptr)
Adds a shape layer to the network.
A Pooling2dDescriptor for the Pooling2dLayer.
A LogicalBinaryDescriptor for the LogicalBinaryLayer.
IConnectableLayer * AddResizeLayer(const ResizeDescriptor &resizeDescriptor, const char *name=nullptr)
Adds a resize layer to the network.
This layer represents an addition operation.
ITensorHandleFactory::FactoryId CalculateSlotOption(BackendsMap &backends, OutputSlot &outputSlot, TensorHandleFactoryRegistry ®istry, bool exportEnabled)
IConnectableLayer * AddUnidirectionalSequenceLstmLayer(const UnidirectionalSequenceLstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
OptimizeForConnection< ConstantLayer, DequantizeLayer, ConvertConstDequantisationLayersToConstLayersImpl > ConvertConstDequantisationLayersToConstLayers
IConnectableLayer * AddConcatLayer(const ConcatDescriptor &concatDescriptor, const char *name=nullptr)
Adds a concatenation layer to the network.
OptimizeForConnection< PermuteLayer, PermuteLayer, OptimizeInversePermutesImpl< PermuteLayer > > OptimizeInversePermutes
IConnectableLayer * AddFullyConnectedLayer(const FullyConnectedDescriptor &fullyConnectedDescriptor, const char *name=nullptr)
IConnectableLayer * AddReshapeLayer(const ReshapeDescriptor &reshapeDescriptor, const char *name=nullptr)
IConnectableLayer * AddBatchToSpaceNdLayer(const BatchToSpaceNdDescriptor &batchToSpaceNdDescriptor, const char *name=nullptr)
Adds a batch to space ND layer to the network.
Main network class which provides the interface for building up a neural network.
OptimizeForExclusiveConnection< Convolution2dLayer, BatchNormalizationLayer, FuseBatchNorm< Convolution2dLayer, armnn::DataType::Float16 > > FuseBatchNormIntoConvolution2DFloat16
std::shared_ptr< ConstTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
OptimizeForExclusiveConnection< PadLayer, Pooling2dLayer, pad_fold::FoldPadIntoPooling2dImpl > FoldPadIntoPooling2d
void ExecuteStrategy(IStrategy &strategy) const
void AddModelOption(armnn::BackendOptions)
IConnectableLayer * AddFillLayer(const FillDescriptor &fillDescriptor, const char *name=nullptr)
Add an Fill layer to the network.
bool GetReduceFp32ToBf16() const
LstmBasicParameters m_BasicParameters
This layer represents a mean operation.
IConnectableLayer * AddQuantizedLstmLayer(const QuantizedLstmInputParams ¶ms, const char *name=nullptr)
Add a QuantizedLstm layer to the network.
bool IsWarningOnly() const
This layer converts data type Float 16 to Float 32.
This layer represents an unknown operation in the input graph.
IConnectableLayer * AddElementwiseUnaryLayer(const ElementwiseUnaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr)
Add an ElementwiseUnary layer to the network.
IConnectableLayer * AddStridedSliceLayer(const StridedSliceDescriptor &stridedSliceDescriptor, const char *name=nullptr)
Adds a strided slice layer to the network.
This layer represents a floor operation.
IConnectableLayer * AddRankLayer(const char *name=nullptr)
Adds a rank layer to the network.
OptimizeForExclusiveConnection< Convolution2dLayer, BatchNormalizationLayer, FuseBatchNorm< Convolution2dLayer, armnn::DataType::Float32 > > FuseBatchNormIntoConvolution2DFloat32
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
An ArgMinMaxDescriptor for ArgMinMaxLayer.
bool IsBackendSupported(const BackendId &backend) const
const Substitutions & GetSubstitutions() const
Private implementation of INetwork.
This layer represents a DepthToSpace operation.
This layer represents a resize operation.
This layer represents a LSTM operation.
IConnectableLayer * AddTransposeLayer(const TransposeDescriptor &transposeDescriptor, const char *name=nullptr)
IConnectableLayer * AddUnidirectionalSequenceLstmLayer(const UnidirectionalSequenceLstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
Add a UnidirectionalSequenceLstm layer to the network.
bool CheckScaleSetOnQuantizedType(Layer *layer, Optional< std::vector< std::string > & > errMessages)
OptimizeForConnection< Layer, PermuteLayer, SquashEqualSiblingsImpl< PermuteLayer > > SquashEqualPermuteSiblings
std::shared_ptr< ConstTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8).
std::vector< ConvertFp16ToFp32Layer * > InsertConvertFp16ToFp32LayersBefore(Graph &graph, Layer &layer, bool expectCorrectInputType)
OptimizeForExclusiveConnection< DepthwiseConvolution2dLayer, BatchNormalizationLayer, FuseBatchNorm< DepthwiseConvolution2dLayer, armnn::DataType::Float32 > > FuseBatchNormIntoDepthwiseConvolution2DFloat32
IConnectableLayer * AddLstmLayer(const LstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
This layer represents a division operation.
This layer represents a maximum operation.
This layer represents a minimum operation.
@ ExportToTarget
Destination backend can work directly with tensors on source backend.
This layer represents a convolution 2d operation.
This layer represents a convolution 3d operation.
ConvertConstants< Float16ToFloat32, IsFloat32Layer > ConvertConstantsHalfToFloat
This layer converts data type Float 32 to Float 16.
IConnectableLayer * AddMaximumLayer(const char *name=nullptr)
IConnectableLayer * AddShapeLayer(const char *name=nullptr)
OptimizationResult AssignBackends(OptimizedNetworkImpl *optNetObjPtr, BackendSettings &backendSettings, Graph::Iterator &firstLayer, Graph::Iterator &lastLayer, Optional< std::vector< std::string > & > errMessages)
virtual MemorySourceFlags GetExportFlags() const
This layer represents a comparison operation.
IConnectableLayer * AddBatchNormalizationLayer(const BatchNormalizationDescriptor &desc, const ConstTensor &mean, const ConstTensor &variance, const ConstTensor &beta, const ConstTensor &gamma, const char *name=nullptr)
This layer represents a SpaceToDepth operation.
IConnectableLayer * AddStackLayer(const StackDescriptor &stackDescriptor, const char *name=nullptr)
constexpr const char * GetDataTypeName(DataType dataType)
IConnectableLayer * AddSoftmaxLayer(const SoftmaxDescriptor &softmaxDescriptor, const char *name=nullptr)
static void ConvertFloat16To32(const void *srcFloat16Buffer, size_t numElements, float *dstFloat32Buffer)
virtual ~OptimizedNetworkImpl()
An InstanceNormalizationDescriptor for InstanceNormalizationLayer.
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.
OptimizeForType< PermuteLayer, PermuteAsReshapeImpl > PermuteAsReshape
IConnectableLayer * AddSliceLayer(const SliceDescriptor &sliceDescriptor, const char *name=nullptr)
IConnectableLayer * AddInputLayer(LayerBindingId id, const char *name=nullptr)
Adds an input layer to the network.
IConnectableLayer * AddQuantizeLayer(const char *name=nullptr)
IConnectableLayer * AddArgMinMaxLayer(const ArgMinMaxDescriptor &desc, const char *name=nullptr)
Adds an ArgMinMax layer to the network.
virtual size_t GetNumInputs() const
This layer represents a elementwiseUnary operation.
@ CpuRef
CPU Execution: Reference C++ kernels.
A ElementwiseBinaryDescriptor for the ElementwiseBinaryLayer.
A layer user-provided data can be bound to (e.g. inputs, outputs).
IConnectableLayer * AddLogicalBinaryLayer(const LogicalBinaryDescriptor &descriptor, const char *name=nullptr)
Adds a Logical Binary layer to the network.
@ CopyToTarget
Source backends tensor data can be exported to destination backend tensor without copy.
DataType GetDataType() const
OptimizeForConnection< ReshapeLayer, ReshapeLayer, OptimizeConsecutiveReshapesImpl > OptimizeConsecutiveReshapes
IConnectableLayer * AddLstmLayer(const LstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
Add a Lstm layer to the network.
IConnectableLayer * AddSplitterLayer(const ViewsDescriptor &splitterDescriptor, const char *name=nullptr)
IConnectableLayer * AddSpaceToBatchNdLayer(const SpaceToBatchNdDescriptor &spaceToBatchNdDescriptor, const char *name=nullptr)
void SetExportEnabled(bool ExportState)
OptimizeForConnection< TransposeLayer, BatchToSpaceNdLayer, PermuteAndBatchToSpaceAsDepthToSpaceImpl< TransposeLayer > > TransposeAndBatchToSpaceAsDepthToSpace
IConnectableLayer * AddSplitterLayer(const ViewsDescriptor &splitterDescriptor, const char *name=nullptr)
Adds a splitter layer to the network.
virtual size_t GetNumOutputs() const
bool m_Debug
Add debug data for easier troubleshooting.
void RegisterProfiler(IProfiler *profiler)
IConnectableLayer * AddReduceLayer(const ReduceDescriptor &reduceDescriptor, const char *name=nullptr)
IConnectableLayer * AddSoftmaxLayer(const SoftmaxDescriptor &softmaxDescriptor, const char *name=nullptr)
Adds a softmax layer to the network.
void SetProfilingEnabled(bool ProfilingState)
const char * GetLayerTypeAsCString(LayerType type)
IConnectableLayer * AddOutputLayer(LayerBindingId id, const char *name=nullptr)
Adds an output layer to the network.
IConnectableLayer * AddPadLayer(const PadDescriptor &padDescriptor, const char *name=nullptr)
IConnectableLayer * AddFullyConnectedLayer(const FullyConnectedDescriptor &fullyConnectedDescriptor, const char *name=nullptr)
Adds a fully connected layer to the network.
ITensorHandleFactory::FactoryId CalculateSlotOptionForInput(BackendsMap &backends, OutputSlot &slot, TensorHandleFactoryRegistry ®istry, bool importEnabled)
This layer represents a stack operation.
@ InferAndValidate
Infer missing output shapes and validate all output shapes.
IConnectableLayer * AddReshapeLayer(const ReshapeDescriptor &reshapeDescriptor, const char *name=nullptr)
Adds a reshape layer to the network.
NetworkImpl(const NetworkOptions &networkOptions={})
armnn::ModelOptions GetModelOptions() const
A SpaceToBatchNdDescriptor for the SpaceToBatchNdLayer.
#define ARMNN_NO_DEPRECATE_WARN_END
bool m_ImportEnabled
Enable Import.