23.08
|
Go to the documentation of this file.
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->AddPermuteLayer(permuteDescriptor, name);
347 return pNetworkImpl->AddBatchToSpaceNdLayer(batchToSpaceNdDescriptor, name);
353 return pNetworkImpl->AddPooling2dLayer(pooling2dDescriptor, name);
359 return pNetworkImpl->AddPooling3dLayer(pooling3dDescriptor, name);
367 return pNetworkImpl->AddPrecompiledLayer(preCompiledDescriptor, std::move(compiledBlobPtr), backend, name);
373 return pNetworkImpl->AddActivationLayer(activationDescriptor, name);
379 return pNetworkImpl->AddNormalizationLayer(normalizationDescriptor, name);
384 return pNetworkImpl->AddSliceLayer(sliceDescriptor, name);
389 return pNetworkImpl->AddSoftmaxLayer(softmaxDescriptor, name);
395 return pNetworkImpl->AddSplitterLayer(splitterDescriptor, name);
424 return pNetworkImpl->AddBatchNormalizationLayer(desc, mean, variance, beta, gamma, name);
435 return pNetworkImpl->AddResizeLayer(resizeDescriptor, name);
441 return pNetworkImpl->AddReduceLayer(reduceDescriptor, name);
447 return pNetworkImpl->AddInstanceNormalizationLayer(desc, name);
453 return pNetworkImpl->AddL2NormalizationLayer(desc, name);
459 return pNetworkImpl->AddLogSoftmaxLayer(logSoftmaxDescriptor, name);
471 return pNetworkImpl->AddReshapeLayer(reshapeDescriptor, name);
477 return pNetworkImpl->AddSpaceToBatchNdLayer(spaceToBatchNdDescriptor, name);
483 return pNetworkImpl->AddSpaceToDepthLayer(spaceToDepthDescriptor, name);
499 return pNetworkImpl->AddLstmLayer(descriptor, params, name);
525 return pNetworkImpl->AddMeanLayer(meanDescriptor, name);
542 return pNetworkImpl->AddStridedSliceLayer(stridedSliceDescriptor, name);
578 return pNetworkImpl->AddTransposeConvolution2dLayer(descriptor, weights, biases, name);
584 return pNetworkImpl->AddTransposeLayer(transposeDescriptor, name);
607 return pNetworkImpl->AddQuantizedLstmLayer(params, name);
614 return pNetworkImpl->AddQLstmLayer(descriptor, params, name);
620 return pNetworkImpl->AddLogicalBinaryLayer(descriptor, name);
628 return pNetworkImpl->AddUnidirectionalSequenceLstmLayer(descriptor, params, name);
634 return pNetworkImpl->AddChannelShuffleLayer(descriptor, name);
640 return pNetworkImpl->AddBatchMatMulLayer(descriptor, name);
661 return new INetwork(networkOptions);
675 : pOptimizedNetworkImpl(new
OptimizedNetworkImpl(*other.pOptimizedNetworkImpl.get(), modelOptions)) {}
681 : pOptimizedNetworkImpl(
std::move(impl)) {}
731 return m_Graph->SerializeToDot(stream);
736 return m_Graph->GetNumInputs();
741 return m_Graph->GetNumOutputs();
745 Optional<std::vector<std::string>&> errorMessages)
747 std::stringstream fullErrorMessage;
748 fullErrorMessage <<
"ERROR: " << errorMessage;
752 errorMessages.value().push_back(fullErrorMessage.str());
757 Optional<std::vector<std::string>&> warningMessages)
759 std::stringstream fullWarningMessage;
760 fullWarningMessage <<
"WARNING: " << warningMessage;
764 warningMessages.value().push_back(fullWarningMessage.str());
771 Optional<std::vector<std::string>&> errMessages)
773 std::stringstream failureMsg;
785 bool noErrors =
true;
787 for (
unsigned int i = 0; i < numOutputs; i++) {
792 if (0.f ==
info.GetQuantizationScale())
795 std::stringstream ss;
797 <<
" (" << layer->
GetNameStr() <<
") is of type"
798 <<
" Quantized 8 bit but its scale parameter has not been set";
802 if ((
info.GetQuantizationScale() != (1.0f / 256.0f) ||
803 info.GetQuantizationOffset() != 0) &&
806 std::stringstream ss;
807 ss <<
"Quantization parameters for Softmax layer (Scale: " <<
808 info.GetQuantizationScale() <<
" and Offset: " <<
info.GetQuantizationOffset() <<
809 ") are incorrect and have been updated to Scale: 0.00390625 and Offset: 0";
811 info.SetQuantizationScale((1.0f /256.0f));
812 info.SetQuantizationOffset(0);
826 const std::vector<BackendId>& availablePreferredBackends,
827 std::string& reasonIfUnsupported,
828 Optional<std::vector<std::string>&> errMessages)
833 auto ReturnError = [&](
const Layer* layer)
841 std::string currentReasonIfUnsupported;
847 reasonIfUnsupported += currentReasonIfUnsupported;
851 std::string checkStr =
"This CPU architecture does not support F16 data type, you need v8.2 or above";
852 if (!isLayerSupported || currentReasonIfUnsupported.find(checkStr) != std::string::npos)
860 auto ConstantLayerFromFp16ToFp32 = [](
Layer& layer)
864 ConstantLayer* constantLayer = PolymorphicDowncast<ConstantLayer*>(&layer);
870 std::vector<float> newValues(
info.GetNumElements());
874 info.GetNumElements(),
887 bool checkType =
false;
891 auto connectedOutputSlot = inputSlot.GetConnectedOutputSlot();
894 if (connectedOutputSlot->GetNumConnections() == 1)
897 ConstantLayerFromFp16ToFp32(connectedOutputSlot->GetOwningLayer());
903 std::vector<ConvertFp16ToFp32Layer*> convertFp16ToFp32Layers;
906 convertFp16ToFp32Layers =
911 std::vector<ConvertFp32ToFp16Layer*> convertFp32ToFp16Layers;
914 convertFp32ToFp16Layers =
919 auto AssignFirstSupportedBackend = [&](
Layer* layer,
BackendId preferredBackend)
921 bool supportedBackendFound =
false;
922 std::string reasonIfUnsupported;
928 reasonIfUnsupported))
930 supportedBackendFound =
true;
934 for (
const auto& backend : availablePreferredBackends)
937 if (backend == preferredBackend)
945 reasonIfUnsupported))
947 supportedBackendFound =
true;
953 return supportedBackendFound;
958 if (!AssignFirstSupportedBackend(convertLayer, backend))
960 return ReturnError(convertLayer);
966 if (!AssignFirstSupportedBackend(convertLayer, backend))
968 return ReturnError(convertLayer);
976 std::stringstream warningMsg;
978 <<
" is not supported on requested backend " << layer->
GetBackendId().
Get()
981 <<
" (reason: " << reasonIfUnsupported
982 <<
"), falling back to the next backend.";
999 return {dataTypeIn, dataTypeOut};
1003 const std::vector<BackendId>& availablePreferredBackends)
1005 bool hasFp16 =
false;
1007 auto firstBackend = availablePreferredBackends[0];
1008 auto backendObjPtr = backends.find(firstBackend)->second.get();
1011 auto backendCapabilities = backendObjPtr->GetCapabilities();
1017 ARMNN_LOG(
debug) <<
"The first available preferred backend: " << firstBackend
1018 <<
", has FP16 support.";
1022 ARMNN_LOG(
warning) <<
"The first available preferred backend: " << firstBackend
1023 <<
", does not have FP16 support. "
1024 <<
"The FP16 turbo mode option will be disable. It will run using FP32.";
1028 for (
size_t i = 1; i < availablePreferredBackends.size(); ++i)
1030 auto backend = availablePreferredBackends[i];
1031 backendObjPtr = backends.find(backend)->second.get();
1032 backendCapabilities = backendObjPtr->GetCapabilities();
1035 ARMNN_LOG(
warning) <<
"Next preferred backend: " << backend <<
", does not have FP16 support. "
1036 <<
"It will run using FP32 when falling back to this backend.";
1040 ARMNN_LOG(
debug) <<
"Next preferred backend: " << backend <<
", has FP16 support.";
1051 Optional<std::vector<std::string>&> errMessages,
1054 std::vector<BackendId>& availablePreferredBackends)
1056 auto ReturnError = [&](
const Layer* layer)
1061 auto layer = PolymorphicDowncast<Layer*>(it);
1070 std::string reasonIfUnsupported;
1080 if (layer->GetBackendHint().has_value() &&
1085 layer->GetBackendHint().value(),
1088 availablePreferredBackends,
1089 reasonIfUnsupported,
1090 errMessages).
IsOk())
1098 for (
const auto& backend : availablePreferredBackends)
1100 if (layer->GetBackendHint().has_value() &&
1101 layer->GetBackendHint().value() == backend)
1112 availablePreferredBackends,
1113 reasonIfUnsupported,
1148 layer->SetBackendId(cpuBackendId);
1153 result = ReturnError(layer);
1163 Optional<std::vector<std::string>&> errMessages)
1169 if (availablePreferredBackends.empty())
1171 std::stringstream failureMsg;
1172 failureMsg <<
"No preferred backends are available";
1179 for (
auto it = firstLayer; it != lastLayer; ++it)
1181 auto layer = PolymorphicDowncast<Layer*>(*it);
1189 bool isFloat16 =
false;
1190 for (
auto type : inOutDataType)
1199 if (layer->GetBackendId() ==
"Unknown" || isFloat16)
1206 availablePreferredBackends);
1210 for (
auto it = firstLayer; it != lastLayer; ++it)
1212 auto layer = PolymorphicDowncast<Layer*>(*it);
1216 BackendId connectedBackendId = layer->GetOutputSlot(0).GetConnection(0)->GetOwningLayer().GetBackendId();
1217 layer->SetBackendId(connectedBackendId);
1228 Optional<std::vector<std::string>&> errMessages)
1234 if (availablePreferredBackends.empty())
1236 std::stringstream failureMsg;
1237 failureMsg <<
"No preferred backends are available";
1244 for (
auto it = firstLayer; it != lastLayer; ++it)
1251 availablePreferredBackends);
1254 for (
auto it = firstLayer; it != lastLayer; ++it)
1256 auto layer = PolymorphicDowncast<Layer*>(*it);
1260 BackendId connectedBackendId = layer->GetOutputSlot(0).GetConnection(0)->GetOwningLayer().GetBackendId();
1261 layer->SetBackendId(connectedBackendId);
1271 Optional<std::vector<std::string>&> errMessages)
1289 auto backendFactory = backendRegistry.GetFactory(selectedBackend);
1290 auto backendObjPtr = backendFactory();
1293 backendObjPtr->RegisterTensorHandleFactories(handleFactoryRegistry);
1295 backends[backendObjPtr->GetId()] = std::move(backendObjPtr);
1305 Optional<std::vector<std::string>&> errMessages)
1317 auto backendObjPtr = backends.find(selectedBackend)->second.get();
1330 [&backendObjPtr](
const Layer& layer)
1337 if (subgraphs.empty())
1344 for (
auto& subgraph : subgraphs)
1348 OptimizationViews optimizationViews = backendObjPtr->OptimizeSubgraphView(*subgraph, modelOptions);
1355 SubgraphView& replacementSubgraph = substitution.m_ReplacementSubgraph;
1356 SubgraphView& substitutableSubgraph = substitution.m_SubstitutableSubgraph;
1361 std::for_each(subgraphLayers.begin(), subgraphLayers.end(), [&selectedBackend](
IConnectableLayer* l)
1364 PolymorphicDowncast<Layer*>(l)->SetBackendId(selectedBackend);
1371 for (
auto& l : deletedSubgraph.GetIConnectableLayers())
1373 Layer* deletedLayer = PolymorphicDowncast<Layer*>(l);
1377 OutputSlot* parentOut = inputSlot.GetConnectedOutputSlot();
1392 std::stringstream warningMsg;
1393 warningMsg <<
"Some sub-graph(s) failed to optimized on " << backendObjPtr->GetId() <<
" backend.";
1398 if (!backendObjPtr->GetId().IsCpuRef())
1408 std::stringstream subgraphMsg;
1409 subgraphMsg <<
"Re-assigning backends to " << failedSubgraph.GetIConnectableLayers().size()
1410 <<
" layers inside sub-graph " << count++;
1417 if (reassignmentResult.
m_Error)
1440 if (srcFactory && dstFactory &&
1466 if (frmBackend == backends.end() ||
1467 !frmBackend->second->SupportsTensorAllocatorAPI())
1474 std::map<ITensorHandleFactory::FactoryId, int> factoryScores;
1481 const Layer& connectedLayer = connection->GetOwningLayer();
1483 auto toBackend = backends.find(connectedLayer.
GetBackendId());
1484 ARMNN_ASSERT_MSG(toBackend != backends.end(),
"Backend id not found for the connected layer");
1486 if (!toBackend->second.get()->SupportsTensorAllocatorAPI())
1492 auto dstPrefs = toBackend->second.get()->GetHandleFactoryPreferences();
1493 for (
auto&& dst : dstPrefs)
1507 auto it = factoryScores.find(dst);
1508 if (it == factoryScores.end())
1511 factoryScores[dst] = 0;
1520 factoryScores[dst]++;
1523 if (factoryScores[dst] > topScore)
1525 topScore = factoryScores[dst];
1554 if (frmBackend == backends.end() ||
1555 !frmBackend->second->SupportsTensorAllocatorAPI())
1560 bool outputConnection =
false;
1563 const Layer& connectedLayer = connection->GetOwningLayer();
1566 outputConnection =
true;
1574 std::map<ITensorHandleFactory::FactoryId, int> factoryScores;
1575 for (
auto&& pref : srcPrefs)
1580 if (outputConnection)
1583 bool fallbackConnection =
false;
1586 if (inputSlot.GetConnectedOutputSlot()->GetOwningLayer().GetBackendId() != layer.
GetBackendId())
1588 fallbackConnection =
true;
1591 if (fallbackConnection)
1595 if (!factoryCap.empty())
1605 if (!outputConnection)
1609 if (!factoryCap.empty())
1628 auto it = factoryScores.find(pref);
1629 if (it == factoryScores.end())
1632 factoryScores[pref] = 0;
1639 const Layer& connectedLayer = connection->GetOwningLayer();
1641 auto toBackend = backends.find(connectedLayer.
GetBackendId());
1642 ARMNN_ASSERT_MSG(toBackend != backends.end(),
"Backend id not found for the connected layer");
1644 auto dstPrefs = toBackend->second.get()->GetHandleFactoryPreferences();
1645 for (
auto&& src : srcPrefs)
1647 if (factoryScores.find(src) == factoryScores.end())
1652 for (
auto&& dst : dstPrefs)
1657 factoryScores[src]++;
1665 int minScore = std::numeric_limits<int>::max();
1666 for (
auto it : factoryScores)
1668 minScore = std::min(minScore, it.second);
1672 std::vector<ITensorHandleFactory::FactoryId> optimalFactories;
1673 for (
auto it : factoryScores)
1675 if (it.second == minScore)
1677 optimalFactories.push_back(it.first);
1682 for (
auto&& srcPref : srcPrefs)
1684 for (
auto&& comp : optimalFactories)
1686 if (comp == srcPref)
1699 const Layer& connectedLayer,
1703 auto toBackend = backends.find(connectedLayer.
GetBackendId());
1704 ARMNN_ASSERT_MSG(toBackend != backends.end(),
"Backend id not found for the connected layer");
1706 auto dstPrefs = toBackend->second.get()->GetHandleFactoryPreferences();
1729 for (
auto&& pref : dstPrefs)
1731 if (pref == srcFactoryId)
1741 for (
auto&& pref : dstPrefs)
1760 if (srcCapability.empty() && dstCapability.empty() && srcFallback.empty() && dstFallback.empty())
1771 for (
auto&& pref : dstPrefs)
1790 Optional<std::vector<std::string>&> errMessages)
1795 optGraph.
ForEachLayer([&backends, ®istry, &result, &errMessages, importEnabled, exportEnabled](
Layer* layer)
1826 unsigned int connectionIdx = 0;
1829 const Layer& connectedLayer = connection->GetOwningLayer();
1832 registry, importEnabled);
1839 errMessages.value().emplace_back(
"Could not find valid strategy required for compatibility"
1840 " between backends.");
1857 const std::vector<BackendId>& backendPreferences,
1860 Optional<std::vector<std::string>&> messages)
1870 const std::vector<BackendId>& backendPreferences,
1873 Optional<std::vector<std::string>&> messages)
1883 if (backendPreferences.empty())
1891 "Please use the FastMathEnabled backend option for CpuAcc or GpuAcc.");
1902 std::unique_ptr<Graph> graph = std::make_unique<Graph>(inGraph);
1910 optimizedOptions.push_back(importExport);
1927 using namespace optimizations;
1969 if (availablePreferredBackends.empty())
1971 std::stringstream failureMsg;
1972 failureMsg <<
"None of the preferred backends " << backendPreferences
2001 if (assignBackendsResult.
m_Error)
2016 if (backendOptimizationResult.
m_Error)
2041 #if !defined(ARMNN_DISABLE_FILESYSTEM)
2043 ARMNN_LOG(
info) <<
"Intermediate tensors will be written to: " << result;
2057 tensorHandleFactoryRegistry,
2079 const std::vector<BackendId>& backendPreferences,
2082 Optional<std::vector<std::string>&> messages)
2092 const std::vector<BackendId>& backendPreferences,
2095 Optional<std::vector<std::string>&> messages)
2104 bool NetworkImpl::GetShapeInferenceMethod()
2106 bool shapeInferenceMethod =
false;
2108 ParseOptions(m_NetworkOptions,
"ShapeInferenceMethod", [&](std::string name,
const BackendOptions::Var& value)
2110 if (name ==
"InferAndValidate")
2112 shapeInferenceMethod |= value.AsBool();
2115 return shapeInferenceMethod;
2118 bool NetworkImpl::GetAllowExpandedDims()
2120 bool allowExpandedDims =
false;
2122 ParseOptions(m_NetworkOptions,
"AllowExpandedDims", [&](std::string name,
const BackendOptions::Var& value)
2124 if (name ==
"AllowExpandedDims")
2126 allowExpandedDims |= value.AsBool();
2129 return allowExpandedDims;
2133 : m_NetworkOptions(networkOptions),
2134 m_Graph(
std::make_unique<
Graph>(GetShapeInferenceMethod(), GetAllowExpandedDims()))
2149 return m_Graph->AddLayer<
InputLayer>(id, name);
2160 return m_Graph->AddLayer<
CastLayer>(name);
2171 return m_Graph->AddLayer<
ComparisonLayer>(comparisonDescriptor, name);
2189 return m_Graph->AddLayer<
FillLayer>(fillDescriptor, name);
2201 return m_Graph->AddLayer<
ConcatLayer>(concatDescriptor, name);
2244 layer->
m_Anchors = std::make_shared<ScopedTensorHandle>(anchors);
2252 return m_Graph->AddLayer<
PermuteLayer>(permuteDescriptor, name);
2258 return m_Graph->AddLayer<
Pooling2dLayer>(pooling2dDescriptor, name);
2264 return m_Graph->AddLayer<
Pooling3dLayer>(pooling3dDescriptor, name);
2270 return m_Graph->AddLayer<
ActivationLayer>(activationDescriptor, name);
2276 return m_Graph->AddLayer<
ArgMinMaxLayer>(argMinMaxDescriptor, name);
2280 normalizationDescriptor,
2288 return m_Graph->AddLayer<
SliceLayer>(sliceDescriptor, name);
2294 return m_Graph->AddLayer<
SoftmaxLayer>(softmaxDescriptor, name);
2300 return m_Graph->AddLayer<
SplitterLayer>(splitterDescriptor, name);
2337 layer->
m_Mean = std::make_shared<ScopedTensorHandle>(mean);
2338 layer->m_Variance = std::make_shared<ScopedTensorHandle>(variance);
2339 layer->m_Beta = std::make_shared<ScopedTensorHandle>(beta);
2340 layer->m_Gamma = std::make_shared<ScopedTensorHandle>(gamma);
2347 return m_Graph->AddLayer<
RankLayer>(name);
2353 return m_Graph->AddLayer<
ReduceLayer>(reduceDescriptor, name);
2358 return m_Graph->AddLayer<
ResizeLayer>(resizeDescriptor, name);
2388 layer->
m_LayerOutput = std::make_shared<ScopedTensorHandle>(input);
2396 return m_Graph->AddLayer<
ReshapeLayer>(reshapeDescriptor, name);
2420 const auto layer = m_Graph->AddLayer<
LstmLayer>(descriptor, name);
2425 layer->m_BasicParameters.m_InputToCellWeights =
2427 layer->m_BasicParameters.m_InputToOutputWeights =
2429 layer->m_BasicParameters.m_RecurrentToForgetWeights =
2431 layer->m_BasicParameters.m_RecurrentToCellWeights =
2433 layer->m_BasicParameters.m_RecurrentToOutputWeights =
2435 layer->m_BasicParameters.m_ForgetGateBias =
2437 layer->m_BasicParameters.m_CellBias =
2438 std::make_shared<ScopedTensorHandle>(*(params.
m_CellBias));
2439 layer->m_BasicParameters.m_OutputGateBias =
2443 if(!descriptor.m_CifgEnabled)
2448 "when CIFG is disabled.");
2453 "AddLstmLayer: Recurrent To Input Weights cannot be NULL "
2454 "when CIFG is disabled.");
2459 "when CIFG is disabled.");
2461 layer->m_CifgParameters.m_InputToInputWeights =
2463 layer->m_CifgParameters.m_RecurrentToInputWeights =
2465 layer->m_CifgParameters.m_InputGateBias =
2470 if(descriptor.m_ProjectionEnabled)
2475 "when projection is enabled.");
2477 layer->m_ProjectionParameters.m_ProjectionWeights =
2481 layer->m_ProjectionParameters.m_ProjectionBias =
2487 if(descriptor.m_PeepholeEnabled)
2489 if(!descriptor.m_CifgEnabled)
2494 "when Peephole is enabled and CIFG disabled.");
2497 layer->m_PeepholeParameters.m_CellToInputWeights =
2504 "when Peephole is enabled.");
2509 "when Peephole is enabled.");
2512 layer->m_PeepholeParameters.m_CellToForgetWeights =
2514 layer->m_PeepholeParameters.m_CellToOutputWeights =
2519 if(descriptor.m_LayerNormEnabled)
2521 if(!descriptor.m_CifgEnabled)
2526 "when layer normalization is enabled and CIFG disabled.");
2528 layer->m_LayerNormParameters.m_InputLayerNormWeights =
2535 "when layer normalization is enabled.");
2540 "when layer normalization is enabled.");
2545 "when layer normalization is enabled.");
2547 layer->m_LayerNormParameters.m_ForgetLayerNormWeights =
2549 layer->m_LayerNormParameters.m_CellLayerNormWeights =
2551 layer->m_LayerNormParameters.m_OutputLayerNormWeights =
2569 return m_Graph->AddLayer<
MeanLayer>(meanDescriptor,name);
2574 return m_Graph->AddLayer<
PadLayer>(padDescriptor,name);
2596 return m_Graph->AddLayer<
GatherLayer>(gatherDescriptor, name);
2631 layer->
m_Weight = std::make_shared<ScopedTensorHandle>(weights);
2633 if (descriptor.m_BiasEnabled)
2635 layer->m_Bias = std::make_shared<ScopedTensorHandle>(biases.
value());
2644 return m_Graph->AddLayer<
TransposeLayer>(transposeDescriptor, name);
2650 return m_Graph->AddLayer<
StackLayer>(stackDescriptor, name);
2668 layer->m_QuantizedLstmParameters.m_InputToForgetWeights =
2670 layer->m_QuantizedLstmParameters.m_InputToCellWeights =
2672 layer->m_QuantizedLstmParameters.m_InputToOutputWeights =
2676 layer->m_QuantizedLstmParameters.m_RecurrentToInputWeights =
2678 layer->m_QuantizedLstmParameters.m_RecurrentToForgetWeights =
2680 layer->m_QuantizedLstmParameters.m_RecurrentToCellWeights =
2682 layer->m_QuantizedLstmParameters.m_RecurrentToOutputWeights =
2686 layer->m_QuantizedLstmParameters.m_InputGateBias =
2688 layer->m_QuantizedLstmParameters.m_ForgetGateBias =
2690 layer->m_QuantizedLstmParameters.m_CellBias =
2691 std::make_shared<ScopedTensorHandle>(params.
GetCellBias());
2692 layer->m_QuantizedLstmParameters.m_OutputGateBias =
2702 const auto layer = m_Graph->AddLayer<
QLstmLayer>(descriptor, name);
2707 layer->m_BasicParameters.m_InputToCellWeights =
2709 layer->m_BasicParameters.m_InputToOutputWeights =
2711 layer->m_BasicParameters.m_RecurrentToForgetWeights =
2713 layer->m_BasicParameters.m_RecurrentToCellWeights =
2715 layer->m_BasicParameters.m_RecurrentToOutputWeights =
2717 layer->m_BasicParameters.m_ForgetGateBias =
2719 layer->m_BasicParameters.m_CellBias =
2720 std::make_shared<ScopedTensorHandle>(*(params.
m_CellBias));
2721 layer->m_BasicParameters.m_OutputGateBias =
2725 if(!descriptor.m_CifgEnabled)
2735 "AddQLstmLayer: Recurrent To Input Weights cannot be NULL");
2743 layer->m_CifgParameters.m_InputToInputWeights =
2745 layer->m_CifgParameters.m_RecurrentToInputWeights =
2747 layer->m_CifgParameters.m_InputGateBias =
2752 if(descriptor.m_ProjectionEnabled)
2759 layer->m_ProjectionParameters.m_ProjectionWeights =
2765 layer->m_ProjectionParameters.m_ProjectionBias =
2772 if(descriptor.m_PeepholeEnabled)
2784 if(!descriptor.m_CifgEnabled)
2791 layer->m_PeepholeParameters.m_CellToInputWeights =
2795 layer->m_PeepholeParameters.m_CellToForgetWeights =
2797 layer->m_PeepholeParameters.m_CellToOutputWeights =
2802 if(descriptor.m_LayerNormEnabled)
2819 if(!descriptor.m_CifgEnabled)
2826 layer->m_LayerNormParameters.m_InputLayerNormWeights =
2830 layer->m_LayerNormParameters.m_ForgetLayerNormWeights =
2832 layer->m_LayerNormParameters.m_CellLayerNormWeights =
2834 layer->m_LayerNormParameters.m_OutputLayerNormWeights =
2856 layer->m_BasicParameters.m_InputToCellWeights =
2858 layer->m_BasicParameters.m_InputToOutputWeights =
2860 layer->m_BasicParameters.m_RecurrentToForgetWeights =
2862 layer->m_BasicParameters.m_RecurrentToCellWeights =
2864 layer->m_BasicParameters.m_RecurrentToOutputWeights =
2866 layer->m_BasicParameters.m_ForgetGateBias =
2868 layer->m_BasicParameters.m_CellBias =
2869 std::make_shared<ScopedTensorHandle>(*(params.
m_CellBias));
2870 layer->m_BasicParameters.m_OutputGateBias =
2874 if(!descriptor.m_CifgEnabled)
2879 "when CIFG is disabled.");
2884 "AddUnidirectionalSequenceLstmLayer: Recurrent To Input Weights cannot be NULL "
2885 "when CIFG is disabled.");
2890 "when CIFG is disabled.");
2892 layer->m_CifgParameters.m_InputToInputWeights =
2894 layer->m_CifgParameters.m_RecurrentToInputWeights =
2896 layer->m_CifgParameters.m_InputGateBias =
2901 if(descriptor.m_ProjectionEnabled)
2906 "when projection is enabled.");
2908 layer->m_ProjectionParameters.m_ProjectionWeights =
2912 layer->m_ProjectionParameters.m_ProjectionBias =
2918 if(descriptor.m_PeepholeEnabled)
2920 if(!descriptor.m_CifgEnabled)
2925 "cannot be NULL when Peephole is enabled and CIFG disabled.");
2928 layer->m_PeepholeParameters.m_CellToInputWeights =
2935 "when Peephole is enabled.");
2940 "when Peephole is enabled.");
2943 layer->m_PeepholeParameters.m_CellToForgetWeights =
2945 layer->m_PeepholeParameters.m_CellToOutputWeights =
2950 if(descriptor.m_LayerNormEnabled)
2952 if(!descriptor.m_CifgEnabled)
2957 "cannot be NULL when layer normalization is enabled and CIFG disabled.");
2959 layer->m_LayerNormParameters.m_InputLayerNormWeights =
2966 "cannot be NULL when layer normalization is enabled.");
2971 "cannot be NULL when layer normalization is enabled.");
2976 "cannot be NULL when layer normalization is enabled.");
2978 layer->m_LayerNormParameters.m_ForgetLayerNormWeights =
2980 layer->m_LayerNormParameters.m_CellLayerNormWeights =
2982 layer->m_LayerNormParameters.m_OutputLayerNormWeights =
3000 return m_Graph->AddLayer<
TileLayer>(desc, name);
3016 layer = m_Graph->AddLayer<
PreCompiledLayer>(preCompiledDescriptor,
"pre-compiled");
3040 layer->ExecuteStrategy(strategy);
3045 : m_Graph(new
Graph(*other.m_Graph.get()))
3046 , m_Guid(
arm::pipe::IProfilingService::GetNextGuid())
3047 , m_ModelOptions(modelOptions)
3052 : m_Graph(
std::move(graph)), m_Guid(
arm::pipe::IProfilingService::GetNextGuid())
3057 : m_Graph(
std::move(graph)), m_Guid(
arm::pipe::IProfilingService::GetNextGuid()), m_ModelOptions(modelOptions)
3074 layer->ExecuteStrategy(strategy);
IConnectableLayer * AddReshapeLayer(const ReshapeDescriptor &reshapeDescriptor, const char *name=nullptr)
Adds a reshape layer to the network.
IConnectableLayer * AddDepthToSpaceLayer(const DepthToSpaceDescriptor &depthToSpaceDescriptor, const char *name=nullptr)
#define ARMNN_ASSERT(COND)
A BatchNormalizationDescriptor for the BatchNormalizationLayer.
IConnectableLayer * AddTransposeConvolution2dLayer(const TransposeConvolution2dDescriptor &descriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr)
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
OptimizeForType< Layer, AddDebugToFileImpl > InsertDebugToFileLayer
IConnectableLayer * AddReverseV2Layer(const char *name=nullptr)
Add a ReverseV2 layer to the network.
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
void ExecuteStrategy(IStrategy &strategy) const
OptimizationResult ApplyBackendOptimizations(OptimizedNetworkImpl *optNetObjPtr, BackendSettings &backendSettings, BackendsMap &backends, const ModelOptions &modelOptions, Optional< std::vector< std::string > & > errMessages)
std::shared_ptr< ConstTensorHandle > m_InputToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [outputSize, inputSize] (QAsymm8).
void SetExportEnabled(bool ExportState)
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...
void ExecuteStrategy(IStrategy &strategy) const
IConnectableLayer * AddLogicalBinaryLayer(const LogicalBinaryDescriptor &logicalBinaryDescriptor, const char *name=nullptr)
void SetTensorHandleFactory(const ITensorHandleFactory::FactoryId &id)
OptimizeForType< Layer, AddDebugImpl > InsertDebugLayer
A ViewsDescriptor for the SplitterLayer.
const std::shared_ptr< IProfiler > & GetProfiler() const
An ActivationDescriptor for the ActivationLayer.
IConnectableLayer * AddFullyConnectedLayer(const FullyConnectedDescriptor &fullyConnectedDescriptor, const char *name=nullptr)
IConnectableLayer * AddQLstmLayer(const QLstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
Add a QLstm layer to the network.
OptimizeForExclusiveConnection< Convolution2dLayer, BatchNormalizationLayer, FuseBatchNorm< Convolution2dLayer, armnn::DataType::Float32 > > FuseBatchNormIntoConvolution2DFloat32
A FullyConnectedDescriptor for the FullyConnectedLayer.
IConnectableLayer * AddReverseV2Layer(const char *name=nullptr)
bool IsWarningOnly() const
IConnectableLayer * AddCastLayer(const char *name=nullptr)
Adds a cast layer to the network.
IConnectableLayer * AddReduceLayer(const ReduceDescriptor &reduceDescriptor, const char *name=nullptr)
Adds a reduce layer to the network.
IConnectableLayer * AddMaximumLayer(const char *name=nullptr)
Add a Maximum layer to the network.
This layer represents a comparison operation.
bool m_ImportEnabled
Enable Import.
A QLstmDescriptor for the QLstmLayer.
virtual bool SupportsMapUnmap() const
const char * GetLayerTypeAsCString(LayerType type)
This layer represents a DepthToSpace operation.
This layer represents a split operation.
This layer represents a merge operation.
@ GpuAcc
GPU Execution: OpenCL: ArmCompute.
IConnectableLayer * AddTransposeLayer(const TransposeDescriptor &transposeDescriptor, const char *name=nullptr)
void RegisterProfiler(IProfiler *profiler)
IConnectableLayer * AddAdditionLayer(const char *name=nullptr)
Adds an addition layer to the network.
std::vector< ConvertFp16ToFp32Layer * > InsertConvertFp16ToFp32LayersBefore(Graph &graph, Layer &layer, bool expectCorrectInputType)
This layer represents a QLstm operation.
void ForEachLayer(Func func) const
const TensorInfo & GetTensorInfo() const override
IConnectableLayer * AddConvolution2dLayer(const Convolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
std::string GetName() const
OptimizerOptionsOpaque & operator=(OptimizerOptionsOpaque other)
virtual Status PrintGraph()
IConnectableLayer * AddSliceLayer(const SliceDescriptor &sliceDescriptor, const char *name=nullptr)
Adds a slice layer to the network.
IConnectableLayer * AddTileLayer(const TileDescriptor &tileDescriptor, const char *name=nullptr)
This layer represents a normalization operation.
A Pooling3dDescriptor for the Pooling3dLayer.
OptimizeForConnection< PermuteLayer, PermuteLayer, OptimizeInversePermutesImpl< PermuteLayer > > OptimizeInversePermutes
BackendIdSet m_IgnoredBackends
This layer represents a log softmax operation.
OptimizeForConnection< TransposeLayer, BatchToSpaceNdLayer, PermuteAndBatchToSpaceAsDepthToSpaceImpl< TransposeLayer > > TransposeAndBatchToSpaceAsDepthToSpace
IConnectableLayer * AddDivisionLayer(const char *name=nullptr)
std::shared_ptr< ConstTensorHandle > m_Mean
A unique pointer to store Mean values.
A ResizeDescriptor for the ResizeLayer.
This layer represents a subtraction operation.
@ DirectCompatibility
No strategy has been defined. Used internally to verify integrity of optimizations.
ITensorHandleFactory::FactoryId CalculateSlotOption(BackendsMap &backends, OutputSlot &outputSlot, TensorHandleFactoryRegistry ®istry, bool exportEnabled)
Optional< BackendId > GetBackendHint() const
An ArgMinMaxDescriptor for ArgMinMaxLayer.
OptimizeForExclusiveConnection< PadLayer, Pooling2dLayer, pad_fold::FoldPadIntoPooling2dImpl > FoldPadIntoPooling2d
@ CpuRef
CPU Execution: Reference C++ kernels.
This layer represents a pooling 3d operation.
An InstanceNormalizationDescriptor for InstanceNormalizationLayer.
OptimizeForType< Layer, ConvertFp32NetworkToFp16Impl > Fp32NetworkToFp16Converter
void EraseLayer(Iterator pos)
Deletes the layer at the specified position.
This layer represents a depthwise convolution 2d operation.
IConnectableLayer * AddAdditionLayer(const char *name=nullptr)
void SetTensorInfo(const TensorInfo &tensorInfo) override
A GatherDescriptor for the GatherLayer.
IConnectableLayer * AddMeanLayer(const MeanDescriptor &meanDescriptor, const char *name=nullptr)
Add a Mean layer to the network.
void SubstituteSubgraph(SubgraphView &subgraph, IConnectableLayer *substituteLayer)
Substitutes the given sub-graph with either a new layer or a new sub-graph.
ITensorHandleFactory * GetFactory(ITensorHandleFactory::FactoryId id) const
Find a TensorHandleFactory by Id Returns nullptr if not found.
This layer represents a floor operation.
virtual Status SerializeToDot(std::ostream &stream) const
IConnectableLayer * AddDequantizeLayer(const char *name=nullptr)
Adds a Dequantize layer to the network.
size_t GetNumInputs() const
IConnectableLayer * AddTileLayer(const TileDescriptor &descriptor, const char *name=nullptr)
Add a Tile layer to the network.
IConnectableLayer * AddSplitterLayer(const ViewsDescriptor &splitterDescriptor, const char *name=nullptr)
OptimizeForExclusiveConnection< PadLayer, Convolution2dLayer, pad_fold::FoldPadIntoConvolution2dImpl > FoldPadIntoConvolution2d
void ExecuteStrategy(IStrategy &strategy) const
A L2NormalizationDescriptor for the L2NormalizationLayer.
This layer represents a mean operation.
void SetReduceFp32ToFp16(bool ReduceFp32ToFp16State)
IConnectableLayer * AddSpaceToBatchNdLayer(const SpaceToBatchNdDescriptor &spaceToBatchNdDescriptor, const char *name=nullptr)
Adds a space to batch layer to the network.
const Subgraphs & GetFailedSubgraphs() const
constexpr const char * GetDataTypeName(DataType dataType)
IConnectableLayer * AddL2NormalizationLayer(const L2NormalizationDescriptor &desc, const char *name=nullptr)
Adds an L2 normalization layer to the network.
void SetDataType(DataType type)
Status SerializeToDot(std::ostream &stream) const
A NormalizationDescriptor for the NormalizationLayer.
OptimizeForConnection< ConstantLayer, DequantizeLayer, ConvertConstDequantisationLayersToConstLayersImpl > ConvertConstDequantisationLayersToConstLayers
arm::pipe::ProfilingGuid GetGuid() const
bool GetExportEnabled() const
IConnectableLayer * AddSubtractionLayer(const char *name=nullptr)
IConnectableLayer * AddComparisonLayer(const ComparisonDescriptor &comparisonDescriptor, const char *name=nullptr)
Add a Comparison layer to the network.
~OptimizerOptionsOpaque()
IConnectableLayer * AddStridedSliceLayer(const StridedSliceDescriptor &stridedSliceDescriptor, const char *name=nullptr)
OptimizeForConnection< Layer, TransposeLayer, MoveTransposeUpImpl > MoveTransposeUp
A ChannelShuffleDescriptor for the ChannelShuffle operator.
IConnectableLayer * AddLogSoftmaxLayer(const LogSoftmaxDescriptor &logSoftmaxDescriptor, const char *name=nullptr)
LstmBasicParameters m_BasicParameters
void VerifyConstantLayerSetTensorInfo() const
For each ConstantLayer in Graph, ensures TensorInfo is set on all output slots.
IConnectableLayer * AddFullyConnectedLayer(const FullyConnectedDescriptor &fullyConnectedDescriptor, const char *name=nullptr)
Adds a fully connected layer to the network.
IConnectableLayer * AddMeanLayer(const MeanDescriptor &meanDescriptor, const char *name=nullptr)
This layer represents a 2D transpose convolution operation.
IConnectableLayer * AddResizeLayer(const ResizeDescriptor &resizeDescriptor, const char *name=nullptr)
IConnectableLayer * AddBatchMatMulLayer(const BatchMatMulDescriptor &descriptor, const char *name=nullptr)
Add a BatchMatMul layer to the network.
virtual MemorySourceFlags GetExportFlags() const
This layer represents a Gather operator.
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
armnn::ModelOptions GetModelOptions() const
OptimizationResult AssignBackends(OptimizedNetworkImpl *optNetObjPtr, BackendSettings &backendSettings, Graph::Iterator &firstLayer, Graph::Iterator &lastLayer, Optional< std::vector< std::string > & > errMessages)
IConnectableLayer * AddLogSoftmaxLayer(const LogSoftmaxDescriptor &logSoftmaxDescriptor, const char *name=nullptr)
Adds a log softmax layer to the network.
#define ARMNN_NO_DEPRECATE_WARN_BEGIN
IConnectableLayer * AddBatchMatMulLayer(const BatchMatMulDescriptor &desc, const char *name=nullptr)
LayerList::const_iterator Iterator
IConnectableLayer * AddLstmLayer(const LstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
IConnectableLayer * AddReduceLayer(const ReduceDescriptor &reduceDescriptor, const char *name=nullptr)
IConnectableLayer * AddConstantLayer(const ConstTensor &input, const char *name=nullptr)
bool GetImportEnabled() const
This layer represents a ArgMinMax operation.
OptimizeForType< PermuteLayer, PermuteAsReshapeImpl > PermuteAsReshape
IConnectableLayers::iterator IConnectableLayerIterator
void ReportWarning(const std::string &warningMessage, Optional< std::vector< std::string > & > warningMessages)
A StackDescriptor for the StackLayer.
bool GetReduceFp32ToBf16() const
static INetwork * CreateRaw(const NetworkOptions &networkOptions={})
This layer represents a stack operation.
IConnectableLayer * AddDepthwiseConvolution2dLayer(const DepthwiseConvolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
const std::vector< InputSlot > & GetInputSlots() const
bool m_ReduceFp32ToFp16
Reduces all Fp32 operators in the model to Fp16 for faster processing.
virtual ~OptimizedNetworkImpl()
int Connect(InputSlot &destination)
OptimizeForConnection< PermuteLayer, BatchToSpaceNdLayer, PermuteAndBatchToSpaceAsDepthToSpaceImpl< PermuteLayer > > PermuteAndBatchToSpaceAsDepthToSpace
OptimizedNetworkImpl(const OptimizedNetworkImpl &other, const ModelOptions &modelOptions)
This layer represents a batch normalization operation.
#define ARMNN_ASSERT_MSG(COND, MSG)
IConnectableLayer * AddPreluLayer(const char *name=nullptr)
Adds a PReLU layer to the network.
bool GetReduceFp32ToFp16() const
OptimizationResult SelectTensorHandleStrategy(Graph &optGraph, BackendsMap &backends, TensorHandleFactoryRegistry ®istry, bool importEnabled, bool exportEnabled, Optional< std::vector< std::string > & > errMessages)
This layer represents a BatchToSpaceNd operation.
IConnectableLayer * AddOutputLayer(LayerBindingId id, const char *name=nullptr)
Adds an output layer to the network.
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.
void ExecuteStrategy(IStrategy &strategy) const
IConnectableLayer * AddStridedSliceLayer(const StridedSliceDescriptor &stridedSliceDescriptor, const char *name=nullptr)
Adds a strided slice layer to the network.
OptimizeForConnection< Layer, PermuteLayer, MovePermuteUpImpl > MovePermuteUp
OptimizeForConnection< ConvertFp16ToFp32Layer, ConvertFp32ToFp16Layer, OptimizeInverseConversionsImpl > OptimizeInverseConversionsFp16
IConnectableLayer * AddSwitchLayer(const char *name=nullptr)
IConnectableLayer * AddSpaceToDepthLayer(const SpaceToDepthDescriptor &spaceToDepthDescriptor, const char *name=nullptr)
static const FactoryId LegacyFactoryId
IConnectableLayer * AddFloorLayer(const char *name=nullptr)
IConnectableLayer * AddSoftmaxLayer(const SoftmaxDescriptor &softmaxDescriptor, const char *name=nullptr)
Adds a softmax layer to the network.
This layer represents a minimum operation.
BackendIdSet m_SelectedBackends
IConnectableLayer * AddPermuteLayer(const PermuteDescriptor &permuteDescriptor, const char *name=nullptr)
Adds a permute layer to the network.
This layer represents a convolution 2d operation.
virtual const char * what() const noexcept override
IConnectableLayer * AddPermuteLayer(const PermuteDescriptor &permuteDescriptor, const char *name=nullptr)
IConnectableLayer * AddRankLayer(const char *name=nullptr)
#define ARMNN_LOG(severity)
IConnectableLayer * AddTransposeLayer(const TransposeDescriptor &transposeDescriptor, const char *name=nullptr)
Adds a transpose layer to the network.
@ CopyToTarget
Source backends tensor data can be exported to destination backend tensor without copy.
armnn::ShapeInferenceMethod GetShapeInferenceMethod() const
IConnectableLayer * AddArgMinMaxLayer(const ArgMinMaxDescriptor &desc, const char *name=nullptr)
virtual std::vector< Capability > GetCapabilities(const IConnectableLayer *layer, const IConnectableLayer *connectedLayer, CapabilityClass capabilityClass)
void SetShapeInferenceMethod(armnn::ShapeInferenceMethod ShapeInferenceMethodType)
A ElementwiseBinaryDescriptor for the ElementwiseBinaryLayer.
IConnectableLayer * AddStackLayer(const StackDescriptor &descriptor, const char *name=nullptr)
Adds a stack layer to the network.
This layer represents a transpose operation.
This layer represents an addition operation.
BackendsMap CreateSupportedBackends(TensorHandleFactoryRegistry &handleFactoryRegistry, BackendSettings &backendSettings)
IConnectableLayer * AddBatchToSpaceNdLayer(const BatchToSpaceNdDescriptor &batchToSpaceNdDescriptor, const char *name=nullptr)
IConnectableLayer * AddPreluLayer(const char *name=nullptr)
ShapeInferenceMethod m_shapeInferenceMethod
Infer output size when not available.
IConnectableLayer * AddPooling3dLayer(const Pooling3dDescriptor &pooling3dDescriptor, const char *name=nullptr)
Adds a 3D pooling layer to the network.
std::list< IConnectableLayer * > IConnectableLayers
IConnectableLayer * AddUnidirectionalSequenceLstmLayer(const UnidirectionalSequenceLstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
IConnectableLayer * AddSoftmaxLayer(const SoftmaxDescriptor &softmaxDescriptor, const char *name=nullptr)
std::vector< BackendOptions > NetworkOptions
Layer & GetOwningLayer() const
IConnectableLayer * AddBatchNormalizationLayer(const BatchNormalizationDescriptor &desc, const ConstTensor &mean, const ConstTensor &variance, const ConstTensor &beta, const ConstTensor &gamma, const char *name=nullptr)
Iterator begin()
Returns iterator pointing to the beginning of the list. Lowercase for range-based for loops.
IConnectableLayer * AddUnidirectionalSequenceLstmLayer(const UnidirectionalSequenceLstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
Add a UnidirectionalSequenceLstm layer to the network.
IConnectableLayer * AddDepthToSpaceLayer(const DepthToSpaceDescriptor &depthToSpaceDescriptor, const char *name=nullptr)
Adds a depth to space layer to the network.
This layer represents a reshape operation.
ConvertConstants< Float32ToFloat16, IsFloat16Layer > ConvertConstantsFloatToHalf
static Subgraphs SelectSubgraphs(Graph &graph, const LayerSelectorFunction &selector)
Selects subgraphs from a graph based on the selector function and the algorithm.
const IConnectableLayers & GetIConnectableLayers() const
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)
IConnectableLayer * AddMergeLayer(const char *name=nullptr)
Adds a merge layer to the network.
This layer converts data type Float 32 to Float 16.
BackendIdSet m_SupportedBackends
This layer converts data type Float 16 to Float 32.
This layer represents a LSTM operation.
void Disconnect(InputSlot &slot)
IConnectableLayer * AddFillLayer(const FillDescriptor &fillDescriptor, const char *name=nullptr)
IConnectableLayer * AddSpaceToDepthLayer(const SpaceToDepthDescriptor &spaceToDepthDescriptor, const char *name=nullptr)
Adds a space to depth layer to the network.
void AddModelOption(armnn::BackendOptions)
IConnectableLayerIterator begin()
static const FactoryId DeferredFactoryId
Use the workload factory to create the tensor handle.
IConnectableLayer * AddPrecompiledLayer(const PreCompiledDescriptor &preCompiledDescriptor, CompiledBlobPtr compiledBlobPtr, const Optional< BackendId > &backend, const char *name=nullptr)
Adds a Precompiled layer to the network.
std::vector< ConvertFp32ToFp16Layer * > InsertConvertFp32ToFp16LayersAfter(Graph &graph, Layer &layer)
A PadDescriptor for the PadLayer.
IConnectableLayer * AddGatherNdLayer(const char *name=nullptr)
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
This layer represents a reduction operation.
A TransposeDescriptor for the TransposeLayer.
This layer represents a multiplication operation.
unsigned int GetNumConnections() const override
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
A SliceDescriptor for the SliceLayer.
static void ConvertFloat16To32(const void *srcFloat16Buffer, size_t numElements, float *dstFloat32Buffer)
void ReportError(const std::string &errorMessage, Optional< std::vector< std::string > & > errorMessages)
bool CheckFp16Support(BackendsMap &backends, const std::vector< BackendId > &availablePreferredBackends)
IConnectableLayer * AddStackLayer(const StackDescriptor &stackDescriptor, const char *name=nullptr)
IConnectableLayer * AddSplitterLayer(const ViewsDescriptor &splitterDescriptor, const char *name=nullptr)
Adds a splitter layer to the network.
IConnectableLayer * AddShapeLayer(const char *name=nullptr)
Adds a shape layer to the network.
IConnectableLayer * AddElementwiseUnaryLayer(const ElementwiseUnaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr)
This layer represents a SpaceToDepth operation.
BackendRegistry & BackendRegistryInstance()
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.
A ReshapeDescriptor for the ReshapeLayer.
A layer user-provided data can be bound to (e.g. inputs, outputs).
IConnectableLayer * AddConvertFp16ToFp32Layer(const char *name=nullptr)
IConnectableLayer * AddOutputLayer(LayerBindingId id, const char *name=nullptr)
bool m_Debug
Add debug data for easier troubleshooting.
OptimizeForConnection< ConstantLayer, PermuteLayer, ConvertConstPermuteLayersToConstLayers > FusePermuteIntoConstLayer
int LayerBindingId
Type of identifiers for bindable layers (inputs, outputs).
IConnectableLayer * AddReshapeLayer(const ReshapeDescriptor &reshapeDescriptor, const char *name=nullptr)
IConnectableLayer * AddQLstmLayer(const QLstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
This layer represents a L2 normalization operation.
bool m_ExportEnabled
Enable Export.
IConnectableLayer * AddMinimumLayer(const char *name=nullptr)
Add a Minimum layer to the network.
const std::string & Get() const
IConnectableLayer * AddConvolution2dLayer(const Convolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
Adds a 2D convolution layer to the network.
unsigned int GetNumOutputSlots() const override
Returns the number of connectable output slots.
Optimizer::Optimizations MakeOptimizations(Args &&... args)
IConnectableLayer * AddInputLayer(LayerBindingId id, const char *name=nullptr)
const Graph & GetGraph() const
IConnectableLayer * AddDetectionPostProcessLayer(const DetectionPostProcessDescriptor &descriptor, const ConstTensor &anchors, const char *name=nullptr)
Adds a Detection PostProcess layer to the network.
A PermuteDescriptor for the PermuteLayer.
This layer dequantizes the input tensor.
A BatchMatMulDescriptor for the BatchMatMul operator.
This layer represents a ReverseV2 operation.
IConnectableLayer * AddLogicalBinaryLayer(const LogicalBinaryDescriptor &descriptor, const char *name=nullptr)
Adds a Logical Binary layer to the network.
This layer represents a SpaceToBatchNd operation.
IConnectableLayer * AddMinimumLayer(const char *name=nullptr)
const std::shared_ptr< IProfiler > & GetProfiler() const
virtual size_t GetNumInputs() const
bool RequiresCopy(ITensorHandleFactory::FactoryId src, ITensorHandleFactory::FactoryId dst, TensorHandleFactoryRegistry ®istry)
The SubgraphView class represents a subgraph of a Graph.
This layer represents a fully connected operation.
IConnectableLayer * AddDivisionLayer(const char *name=nullptr)
Adds a division layer to the network.
This layer represents an unknown operation in the input graph.
OptimizationResult ReturnWithError(OptimizationResult res, const Layer *layer, const BackendSettings &backendSettings, Optional< std::vector< std::string > & > errMessages)
virtual MemorySourceFlags GetImportFlags() const
IConnectableLayer * AddElementwiseBinaryLayer(const ElementwiseBinaryDescriptor &elementwiseBinaryDescriptor, const char *name=nullptr)
bool GetDebugToFileEnabled() const
A SpaceToBatchNdDescriptor for the SpaceToBatchNdLayer.
IConnectableLayer * AddRankLayer(const char *name=nullptr)
Adds a rank layer to the network.
IConnectableLayer * AddPadLayer(const PadDescriptor &padDescriptor, const char *name=nullptr)
Adds a fully pad layer to the network.
A Convolution3dDescriptor for the Convolution3dLayer.
This layer represents a QuantizedLstm operation.
This layer represents a elementwiseBinary operation.
This layer represents a pooling 2d operation.
IConnectableLayer * AddQuantizeLayer(const char *name=nullptr)
This layer calculates both true and false outputs for input.
IConnectableLayer * AddNormalizationLayer(const NormalizationDescriptor &normalizationDescriptor, const char *name=nullptr)
This layer represents a division operation.
IConnectableLayer * AddLstmLayer(const LstmDescriptor &descriptor, const LstmInputParams ¶ms, const char *name=nullptr)
Add a Lstm layer to the network.
Private implementation of INetwork.
size_t GetNumOutputs() const
std::vector< DataType > GetLayerInOutDatatype(const Layer *layer)
BackendIdVector GetAvailablePreferredBackends() const
bool m_ProfilingEnabled
Enable profiling dump of the optimizer phase.
IConnectableLayer * AddMergeLayer(const char *name=nullptr)
void SetAllowExpandedDims(bool ExpandedDimsAllowed)
IConnectableLayer * AddShapeLayer(const char *name=nullptr)
DataType GetDataType() const
IConnectableLayer * AddStandInLayer(const StandInDescriptor &descriptor, const char *name=nullptr)
Add a stand-in layer for a type unknown to the Arm NN framework.
const std::string & GetNameStr() const
static bool IsLayerSupported(const BackendId &backendId, const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported)
This layer represents a fill operation.
IConnectableLayer * AddConcatLayer(const ConcatDescriptor &concatDescriptor, const char *name=nullptr)
bool GetDebugEnabled() const
unsigned int GetNumInputSlots() const override
Returns the number of connectable input slots.
This layer represents an instance normalization operation.
IConnectableLayer * AddCastLayer(const char *name=nullptr)
IConnectableLayer * AddSwitchLayer(const char *name=nullptr)
Adds a switch layer to the network.
IConnectableLayer * AddElementwiseBinaryLayer(const ElementwiseBinaryDescriptor &elementwiseBinaryDescriptor, const char *name=nullptr)
Add an ElementwiseBinary layer to the network.
std::shared_ptr< ConstTensorHandle > m_Anchors
A unique pointer to store Anchor values.
@ ValidateOnly
Validate all output shapes.
This layer represents a cast operation.
This layer represents a LSTM operation.
IConnectableLayer * AddFillLayer(const FillDescriptor &fillDescriptor, const char *name=nullptr)
Add an Fill layer to the network.
A BatchToSpaceNdDescriptor for the BatchToSpaceNdLayer.
@ InferAndValidate
Infer missing output shapes and validate all output shapes.
A Convolution2dDescriptor for the Convolution2dLayer.
IConnectableLayer * AddStandInLayer(const StandInDescriptor &descriptor, const char *name=nullptr)
A ComparisonDescriptor for the ComparisonLayer.
A FillDescriptor for the FillLayer.
IConnectableLayer * AddSubtractionLayer(const char *name=nullptr)
Adds a subtraction layer to the network.
bool m_ReduceFp32ToBf16
@Note This feature has been replaced by enabling Fast Math in compute library backend options.
IConnectableLayer * AddQuantizedLstmLayer(const QuantizedLstmInputParams ¶ms, const char *name=nullptr)
void ParseOptions(const std::vector< BackendOptions > &options, BackendId backend, F f)
A StandInDescriptor for the StandIn layer.
QuantizedLstmParameters m_QuantizedLstmParameters
ModelOptions m_ModelOptions
Enable Model Options.
IConnectableLayer * AddQuantizedLstmLayer(const QuantizedLstmInputParams ¶ms, const char *name=nullptr)
Add a QuantizedLstm layer to the network.
This layer represents a strided slice operation.
LstmBasicParameters m_BasicParameters
bool Validate(const SubgraphView &originalSubgraph) const
OptimizeForConnection< ConvertFp32ToFp16Layer, ConvertFp16ToFp32Layer, OptimizeInverseConversionsImpl > OptimizeInverseConversionsFp32
bool IsCpuRefUsed() const
Struct for the users to pass backend specific options.
IConnectableLayer * AddDequantizeLayer(const char *name=nullptr)
LayerType GetType() const override
Returns the armnn::LayerType of this layer.
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,...
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.
A StridedSliceDescriptor for the StridedSliceLayer.
ITensorHandleFactory::FactoryId CalculateSlotOptionForOutput(BackendsMap &backends, OutputSlot &slot, TensorHandleFactoryRegistry ®istry)
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.
INetwork(NetworkOptions networkOptions={})
OptimizeForType< TransposeLayer, TransposeAsReshapeImpl > TransposeAsReshape
std::shared_ptr< ConstTensorHandle > m_Weight
A unique pointer to store weight values.
Iterator end()
Returns iterator pointing to the end of the list. Lowercase for range-based for loops.
A LogicalBinaryDescriptor for the LogicalBinaryLayer.
static ProfilerManager & GetInstance()
This layer represents an activation operation with the specified activation function.
bool GetAllowExpandedDims() const
This layer represents a softmax operation.
ITensorHandleFactory::FactoryId CalculateSlotOptionForInput(BackendsMap &backends, OutputSlot &slot, TensorHandleFactoryRegistry ®istry, bool importEnabled)
#define ARMNN_NO_DEPRECATE_WARN_END
IConnectableLayer * AddDepthwiseConvolution2dLayer(const DepthwiseConvolution2dDescriptor &convolution2dDescriptor, const char *name=nullptr)
Adds a 2D depthwise convolution layer to the network.
IConnectableLayer * AddPooling2dLayer(const Pooling2dDescriptor &pooling2dDescriptor, const char *name=nullptr)
Adds a 2D pooling layer to the network.
OptimizeForExclusiveConnection< Convolution2dLayer, BatchNormalizationLayer, FuseBatchNorm< Convolution2dLayer, armnn::DataType::Float16 > > FuseBatchNormIntoConvolution2DFloat16
std::shared_ptr< ConstTensorHandle > m_LayerOutput
IConnectableLayer * AddNormalizationLayer(const NormalizationDescriptor &normalizationDescriptor, const char *name=nullptr)
Adds a normalization layer to the network.
const std::string ToString() const
This layer represents a GatherNd operator.
void IgnoreUnused(Ts &&...)
IConnectableLayer * AddQuantizeLayer(const char *name=nullptr)
Add a quantize layer to the network.
@ ExportToTarget
Destination backend can work directly with tensors on source backend.
static void Destroy(INetwork *network)
const std::vector< InputSlot * > & GetConnections() const
void SetEdgeStrategy(unsigned int connectionIndex, EdgeStrategy strategy)
const Substitutions & GetSubstitutions() const
std::unique_ptr< NetworkImpl > pNetworkImpl
IConnectableLayerIterator end()
static void Destroy(IOptimizedNetwork *network)
const Subgraphs & GetDeletedSubgraphs() const
const BackendId & GetBackendId() const
IConnectableLayer * AddL2NormalizationLayer(const L2NormalizationDescriptor &desc, const char *name=nullptr)
This layer represents a convolution 3d operation.
IConnectableLayer * AddActivationLayer(const ActivationDescriptor &activationDescriptor, const char *name=nullptr)
OptimizeForExclusiveConnection< DepthwiseConvolution2dLayer, BatchNormalizationLayer, FuseBatchNorm< DepthwiseConvolution2dLayer, armnn::DataType::Float16 > > FuseBatchNormIntoDepthwiseConvolution2DFloat16
An OriginsDescriptor for the ConcatLayer.
std::map< BackendId, std::unique_ptr< class IBackendInternal > > BackendsMap
@ CpuAcc
CPU Execution: NEON: ArmCompute.
IConnectableLayer * AddPooling3dLayer(const Pooling3dDescriptor &pooling3dDescriptor, const char *name=nullptr)
bool GetProfilingEnabled() const
OptimizeForConnection< Layer, TransposeLayer, SquashEqualSiblingsImpl< TransposeLayer > > SquashEqualTransposeSiblings
A layer that the constant data can be bound to.
Copyright (c) 2021 ARM Limited and Contributors.
A ElementwiseUnaryDescriptor for the ElementwiseUnaryLayer.
A TransposeConvolution2dDescriptor for the TransposeConvolution2dLayer.
ConvertConstants< Float16ToFloat32, IsFloat32Layer > ConvertConstantsHalfToFloat
void SetPreCompiledObject(PreCompiledObjectPtr preCompiledObject)
void SetBackendId(const BackendId &id) override
Set the backend of the IConnectableLayer.
IConnectableLayer * AddPooling2dLayer(const Pooling2dDescriptor &pooling2dDescriptor, const char *name=nullptr)
This layer represents a elementwiseUnary operation.
This layer represents a detection postprocess operator.
void SetProfilingEnabled(bool ProfilingState)
IOptimizedNetwork(const IOptimizedNetwork &other, const ModelOptions &modelOptions)
Creates a copy of the IOptimizedNetwork.
IConnectableLayer * AddConcatLayer(const ConcatDescriptor &concatDescriptor, const char *name=nullptr)
Adds a concatenation layer to the network.
OptimizeForConnection< Layer, PermuteLayer, SquashEqualSiblingsImpl< PermuteLayer > > SquashEqualPermuteSiblings
void SetDebugToFileEnabled(bool DebugFileState)
This layer represents a Logical Binary operation.
bool m_DebugToFile
Pass debug data to separate output files for easier troubleshooting.
IConnectableLayer * AddMultiplicationLayer(const char *name=nullptr)
Adds a multiplication layer to the network.
IConnectableLayer * AddConvolution3dLayer(const Convolution3dDescriptor &convolution3dDescriptor, const char *name=nullptr)
Adds a 3D convolution layer to the network.
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
This layer represents a permutation operation.
static void Pass(Graph &graph, const Optimizations &optimizations)
Device specific knowledge to be passed to the optimizer.
IConnectableLayer * AddMultiplicationLayer(const char *name=nullptr)
virtual std::vector< ITensorHandleFactory::FactoryId > GetHandleFactoryPreferences() const
(Optional) Returns a vector of supported TensorHandleFactory ids in preference order.
std::vector< BackendOptions > ModelOptions
OptimizeForExclusiveConnection< PadLayer, DepthwiseConvolution2dLayer, pad_fold::FoldPadIntoDepthwiseConvolution2dImpl > FoldPadIntoDepthwiseConvolution2d
IConnectableLayer * AddElementwiseUnaryLayer(const ElementwiseUnaryDescriptor &elementwiseUnaryDescriptor, const char *name=nullptr)
Add an ElementwiseUnary layer to the network.
bool m_BiasEnabled
Enable/disable bias.
A PreCompiledDescriptor for the PreCompiledLayer.
IConnectableLayer * AddConvertFp32ToFp16Layer(const char *name=nullptr)
std::string CreateDirectory(std::string sPath)
Returns full path to temporary folder.
IConnectableLayer * AddInstanceNormalizationLayer(const InstanceNormalizationDescriptor &desc, const char *name=nullptr)
IConnectableLayer * AddChannelShuffleLayer(const ChannelShuffleDescriptor &descriptor, const char *name=nullptr)
Add a ChannelShuffle layer to the network.
IConnectableLayer * AddInstanceNormalizationLayer(const InstanceNormalizationDescriptor &desc, const char *name=nullptr)
Adds an instance normalization layer to the network.
bool IsBackendSupported(const BackendId &backend) const
NetworkImpl(const NetworkOptions &networkOptions={})
OptimizeForConnection< Layer, ReshapeLayer, SquashEqualSiblingsImpl< ReshapeLayer > > SquashEqualReshapeSiblings
IConnectableLayer * AddFloorLayer(const char *name=nullptr)
Adds a floor layer to the network.
IConnectableLayer * AddConvolution3dLayer(const Convolution3dDescriptor &convolution3dDescriptor, const char *name=nullptr)
This layer represents a resize operation.
This layer represents a maximum operation.
EdgeStrategy CalculateEdgeStrategy(BackendsMap &backends, ITensorHandleFactory::FactoryId srcFactoryId, const Layer &layer, const Layer &connectedLayer, TensorHandleFactoryRegistry ®istry, bool importEnabled)
A Pooling2dDescriptor for the Pooling2dLayer.
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.
IConnectableLayer * AddChannelShuffleLayer(const ChannelShuffleDescriptor &channelShuffleDescriptor, const char *name=nullptr)
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
ShapeInferenceMethod
The ShapeInferenceMethod modify how the output shapes are treated.
bool m_AllowExpandedDims
When calculating tensor sizes, dimensions of size == 1 will be ignored.
IConnectableLayer * AddGatherLayer(const GatherDescriptor &descriptor, const char *name=nullptr)
Add Gather layer to the network.
OptimizeForConnection< TransposeLayer, TransposeLayer, OptimizeInversePermutesImpl< TransposeLayer > > OptimizeInverseTransposes
QLstmBasicParameters m_BasicParameters
A ReduceDescriptor for the REDUCE operators.
IConnectableLayer * AddSpaceToBatchNdLayer(const SpaceToBatchNdDescriptor &spaceToBatchNdDescriptor, const char *name=nullptr)
IConnectableLayer * AddSliceLayer(const SliceDescriptor &sliceDescriptor, const char *name=nullptr)
static INetworkPtr Create(const NetworkOptions &networkOptions={})
OptimizeForType< Layer, AddBroadcastReshapeLayerImpl > AddBroadcastReshapeLayer
OptimizeForExclusiveConnection< DepthwiseConvolution2dLayer, BatchNormalizationLayer, FuseBatchNorm< DepthwiseConvolution2dLayer, armnn::DataType::Float32 > > FuseBatchNormIntoDepthwiseConvolution2DFloat32
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
const InputSlot * GetConnection(unsigned int index) const override
OptimizeForConnection< ReshapeLayer, ReshapeLayer, OptimizeConsecutiveReshapesImpl > OptimizeConsecutiveReshapes
virtual size_t GetNumOutputs() const
A MeanDescriptor for the MeanLayer.
std::unique_ptr< void, CompiledBlobDeleter > CompiledBlobPtr
std::vector< SubgraphView::SubgraphViewPtr > Subgraphs
IConnectableLayer * AddGatherLayer(const GatherDescriptor &gatherDescriptor, const char *name=nullptr)
IConnectableLayer * AddPrecompiledLayer(const PreCompiledDescriptor &preCompiledDescriptor, CompiledBlobPtr compiledBlobPtr, const Optional< BackendId > &backend, const char *name=nullptr)
bool CheckScaleSetOnQuantizedType(Layer *layer, Optional< std::vector< std::string > & > errMessages)
void SetDebugEnabled(bool DebugState)
IConnectableLayer * AddBatchToSpaceNdLayer(const BatchToSpaceNdDescriptor &batchToSpaceNdDescriptor, const char *name=nullptr)
Adds a batch to space ND layer to the network.
This layer represents a pad operation.
IConnectableLayer * AddPadLayer(const PadDescriptor &padDescriptor, const char *name=nullptr)
A SoftmaxDescriptor for the SoftmaxLayer.
BackendIdVector m_PreferredBackends
std::shared_ptr< ConstTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8).
IConnectableLayer * AddResizeLayer(const ResizeDescriptor &resizeDescriptor, const char *name=nullptr)
Adds a resize layer to the network.
IConnectableLayer * AddInputLayer(LayerBindingId id, const char *name=nullptr)
Adds an input layer to the network.
A SpaceToDepthDescriptor for the SpaceToDepthLayer.
bool has_value() const noexcept
IConnectableLayer * AddMaximumLayer(const char *name=nullptr)
IConnectableLayer * AddDetectionPostProcessLayer(const DetectionPostProcessDescriptor &descriptor, const ConstTensor &anchors, const char *name=nullptr)
This layer dequantizes the input tensor.
IConnectableLayer * AddArgMinMaxLayer(const ArgMinMaxDescriptor &desc, const char *name=nullptr)
Adds an ArgMinMax layer to the network.
std::unique_ptr< OptimizedNetworkImpl > pOptimizedNetworkImpl
void AssignBackendsIConnectable(OptimizedNetworkImpl *optNetObjPtr, IConnectableLayer *it, Optional< std::vector< std::string > & > errMessages, OptimizationResult &result, BackendSettings &backendSettings, std::vector< BackendId > &availablePreferredBackends)
IConnectableLayer * AddGatherNdLayer(const char *name=nullptr)
Add GatherNd layer to the network.
IConnectableLayer * AddActivationLayer(const ActivationDescriptor &activationDescriptor, const char *name=nullptr)
Adds an activation layer to the network.
bool HasMatchingCapability(const BackendOptions::BackendOption &capability, const BackendCapabilities &capabilities)
Convenience function to check if a given capability matches a capability in a BackendCapabilities str...
Main network class which provides the interface for building up a neural network.
void SetImportEnabled(bool ImportState)