44 virtual unsigned int GetNumConnections()
const = 0;
48 virtual void SetTensorInfo(
const TensorInfo& tensorInfo) = 0;
50 virtual bool IsTensorInfoSet()
const = 0;
55 virtual unsigned int CalculateIndexOnOwner()
const = 0;
57 virtual LayerGuid GetOwningLayerGuid()
const = 0;
72 virtual const char* GetName()
const = 0;
75 virtual unsigned int GetNumInputSlots()
const = 0;
78 virtual unsigned int GetNumOutputSlots()
const = 0;
81 virtual const IInputSlot& GetInputSlot(
unsigned int index)
const = 0;
84 virtual IInputSlot& GetInputSlot(
unsigned int index) = 0;
87 virtual const IOutputSlot& GetOutputSlot(
unsigned int index)
const = 0;
90 virtual IOutputSlot& GetOutputSlot(
unsigned int index) = 0;
93 virtual std::vector<TensorShape> InferOutputShapes(
const std::vector<TensorShape>& inputShapes)
const = 0;
99 virtual void ExecuteStrategy(
IStrategy& strategy)
const = 0;
114 using ConstantTensors = std::vector<std::reference_wrapper<std::shared_ptr<ConstTensorHandle>>>;
130 : m_ReduceFp32ToFp16(false)
132 , m_ReduceFp32ToBf16(false)
134 , m_ImportEnabled(false)
136 , m_ProfilingEnabled(false)
137 , m_ExportEnabled(false)
141 ModelOptions modelOptions = {},
bool exportEnabled =
false)
142 : m_ReduceFp32ToFp16(reduceFp32ToFp16)
144 , m_ReduceFp32ToBf16(reduceFp32ToBf16)
146 , m_ImportEnabled(importEnabled)
147 , m_ModelOptions(modelOptions)
148 , m_ProfilingEnabled(
false)
149 , m_ExportEnabled(exportEnabled)
151 if (m_ReduceFp32ToFp16 && m_ReduceFp32ToBf16)
159 bool importEnabled =
false,
ModelOptions modelOptions = {},
bool exportEnabled =
false)
160 : m_ReduceFp32ToFp16(reduceFp32ToFp16)
162 , m_ReduceFp32ToBf16(reduceFp32ToBf16)
163 , m_shapeInferenceMethod(shapeInferenceMethod)
164 , m_ImportEnabled(importEnabled)
165 , m_ModelOptions(modelOptions)
166 , m_ProfilingEnabled(
false)
167 , m_ExportEnabled(exportEnabled)
169 if (m_ReduceFp32ToFp16 && m_ReduceFp32ToBf16)
177 std::stringstream stream;
178 stream <<
"OptimizerOptions: \n";
179 stream <<
"\tReduceFp32ToFp16: " << m_ReduceFp32ToFp16 <<
"\n";
180 stream <<
"\tReduceFp32ToBf16: " << m_ReduceFp32ToBf16 <<
"\n";
181 stream <<
"\tDebug: " << m_Debug <<
"\n";
182 stream <<
"\tShapeInferenceMethod: " <<
184 stream <<
"\tImportEnabled: " << m_ImportEnabled <<
"\n";
185 stream <<
"\tExportEnabled: " << m_ExportEnabled <<
"\n";
186 stream <<
"\tProfilingEnabled: " << m_ProfilingEnabled <<
"\n";
188 stream <<
"\tModelOptions: \n";
189 for (
auto optionsGroup : m_ModelOptions)
191 for (
size_t i=0; i < optionsGroup.GetOptionCount(); i++)
194 stream <<
"\t\tBackend: " << optionsGroup.GetBackendId() <<
"\n" 195 <<
"\t\t\tOption: " << option.
GetName() <<
"\n" 238 using INetworkPtr = std::unique_ptr<INetwork, void(*)(INetwork* network)>;
251 static void Destroy(
INetwork* network);
267 const char* name =
nullptr);
279 const char* name =
nullptr);
289 const char* name =
nullptr);
296 const char* name =
nullptr);
308 const char* name =
nullptr);
313 const char* name =
nullptr);
319 const char* name =
nullptr);
326 const char* name =
nullptr);
333 const char* name =
nullptr);
340 const char* name =
nullptr);
353 const char* name =
nullptr);
367 const char* name =
nullptr);
374 const char* name =
nullptr);
381 const char* name =
nullptr);
406 const char* name =
nullptr);
413 const char* name =
nullptr);
420 const char* name =
nullptr);
427 const char* name =
nullptr);
434 const char* name =
nullptr);
445 const char* name =
nullptr);
452 const char* name =
nullptr);
459 const char* name =
nullptr);
474 const char* name =
nullptr);
484 const char* name =
nullptr);
513 const char* name =
nullptr);
525 const char* name =
nullptr);
532 const char* name =
nullptr);
539 const char* name =
nullptr);
547 const char* name =
nullptr);
554 const char* name =
nullptr);
564 const char* name =
nullptr);
571 const char* name =
nullptr);
583 const char* name =
nullptr);
590 const char* name =
nullptr);
611 const char* name =
nullptr);
641 const char* name =
nullptr);
653 const char* name =
nullptr);
665 const char* name =
nullptr);
691 const char* name =
nullptr);
698 const char* name =
nullptr);
705 const char* name =
nullptr);
714 const char* name =
nullptr);
721 const char* name =
nullptr);
730 const char* name =
nullptr);
737 const char* name =
nullptr);
746 const char* name =
nullptr);
753 const char* name =
nullptr);
760 const char* name =
nullptr);
762 void ExecuteStrategy(
IStrategy& strategy)
const;
767 friend void VisitLayersTopologically(
const INetwork* inputNetwork,
IStrategy& strategy);
768 friend class TestConnectionPreservation;
771 const std::vector<BackendId>& backendPreferences,
774 Optional<std::vector<std::string>&> messages);
781 namespace experimental
783 class AsyncNetworkImpl;
797 Status SerializeToDot(std::ostream& stream)
const;
799 arm::pipe::ProfilingGuid GetGuid()
const;
802 size_t GetNumOutputs()
const;
804 void ExecuteStrategy(
IStrategy& strategy)
const;
813 const std::shared_ptr<IProfiler>& GetProfiler()
const;
818 friend class experimental::AsyncNetworkImpl;
824 const std::vector<BackendId>& backendPreferences,
827 Optional<std::vector<std::string>&> messages);
829 const std::vector<BackendId>& backendPreferences,
832 Optional<std::vector<std::string>&> messages);
849 const std::vector<BackendId>& backendPreferences,
864 const std::vector<BackendId>& backendPreferences,
ModelOptions m_ModelOptions
A ViewsDescriptor for the SplitterLayer.
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
ShapeInferenceMethod m_shapeInferenceMethod
A TransposeConvolution2dDescriptor for the TransposeConvolution2dLayer.
~IConnectableLayer()
Objects are not deletable via the handle.
A ReshapeDescriptor for the ReshapeLayer.
A ComparisonDescriptor for the ComparisonLayer.
std::vector< BackendOptions > ModelOptions
A Convolution2dDescriptor for the Convolution2dLayer.
OptimizerOptions(bool reduceFp32ToFp16, bool debug, bool reduceFp32ToBf16, bool importEnabled, ModelOptions modelOptions={}, bool exportEnabled=false)
Main network class which provides the interface for building up a neural network. ...
std::vector< BackendOptions > NetworkOptions
bool m_ReduceFp32ToBf16
Reduces all Fp32 operators in the model to Bf16 for faster processing.
A LogicalBinaryDescriptor for the LogicalBinaryLayer.
Copyright (c) 2021 ARM Limited and Contributors.
A SpaceToDepthDescriptor for the SpaceToDepthLayer.
A BatchToSpaceNdDescriptor for the BatchToSpaceNdLayer.
Private implementation of INetwork.
int LayerBindingId
Type of identifiers for bindable layers (inputs, outputs).
A ResizeBilinearDescriptor for the ResizeBilinearLayer.
Base class for all descriptors.
A StackDescriptor for the StackLayer.
std::unique_ptr< void, CompiledBlobDeleter > CompiledBlobPtr
bool m_ReduceFp32ToFp16
Reduces all Fp32 operators in the model to Fp16 for faster processing.
A PadDescriptor for the PadLayer.
const std::string ToString() const
std::unique_ptr< NetworkImpl > pNetworkImpl
uint32_t GetNumInputs(bool biasEnabled)
std::vector< std::reference_wrapper< std::shared_ptr< ConstTensorHandle > >> ConstantTensors
An LstmDescriptor for the LstmLayer.
IOptimizedNetworkPtr Optimize(const INetwork &network, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptions &options=OptimizerOptions(), Optional< std::vector< std::string > &> messages=EmptyOptional())
Create an optimized version of the network.
An output connection slot for a layer.
A L2NormalizationDescriptor for the L2NormalizationLayer.
An ArgMinMaxDescriptor for ArgMinMaxLayer.
An OriginsDescriptor for the ConcatLayer.
A ReduceDescriptor for the REDUCE operators.
A FullyConnectedDescriptor for the FullyConnectedLayer.
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
Validate all output shapes.
A GatherDescriptor for the GatherLayer.
std::unique_ptr< OptimizedNetworkImpl > pOptimizedNetworkImpl
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
ARMNN_NO_DEPRECATE_WARN_BEGIN struct ARMNN_DEPRECATED_MSG_REMOVAL_DATE("ResizeBilinearQueueDescriptor is deprecated use ResizeQueueDescriptor instead", "22.08") ResizeBilinearQueueDescriptor
A StandInDescriptor for the StandIn layer.
A QLstmDescriptor for the QLstmLayer.
Device specific knowledge to be passed to the optimizer.
ArmNN performs an optimization on each model/network before it gets loaded for execution.
An ActivationDescriptor for the ActivationLayer.
A SliceDescriptor for the SliceLayer.
std::function< void(const void *)> CompiledBlobDeleter
A Convolution3dDescriptor for the Convolution3dLayer.
A BatchMatMulDescriptor for the BatchMatMul operator.
A Pooling3dDescriptor for the Pooling3dLayer.
Graph & GetGraphForTesting(IOptimizedNetwork *optNet)
A SpaceToBatchNdDescriptor for the SpaceToBatchNdLayer.
arm::pipe::ProfilingGuid LayerGuid
Define LayerGuid type.
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
A ElementwiseUnaryDescriptor for the ElementwiseUnaryLayer.
std::string GetName() const
A MeanDescriptor for the MeanLayer.
A TransposeDescriptor for the TransposeLayer.
A StridedSliceDescriptor for the StridedSliceLayer.
ModelOptions & GetModelOptionsForTesting(IOptimizedNetwork *optNet)
void Connect(armnn::IConnectableLayer *from, armnn::IConnectableLayer *to, const armnn::TensorInfo &tensorInfo, unsigned int fromIndex, unsigned int toIndex)
#define ARMNN_DEPRECATED_MSG(message)
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
A PreCompiledDescriptor for the PreCompiledLayer.
~IOutputSlot()
Not user deletable.
A Pooling2dDescriptor for the Pooling2dLayer.
A NormalizationDescriptor for the NormalizationLayer.
An InstanceNormalizationDescriptor for InstanceNormalizationLayer.
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
A ChannelShuffleDescriptor for the ChannelShuffle operator.
A SoftmaxDescriptor for the SoftmaxLayer.
ShapeInferenceMethod
The ShapeInferenceMethod modify how the output shapes are treated.
OptimizerOptions(bool reduceFp32ToFp16, bool debug, bool reduceFp32ToBf16=false, ShapeInferenceMethod shapeInferenceMethod=armnn::ShapeInferenceMethod::ValidateOnly, bool importEnabled=false, ModelOptions modelOptions={}, bool exportEnabled=false)
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
A FillDescriptor for the FillLayer.
A BatchNormalizationDescriptor for the BatchNormalizationLayer.
A PermuteDescriptor for the PermuteLayer.
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below...