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_DebugToFile(false)
133 , m_ReduceFp32ToBf16(false)
135 , m_ImportEnabled(false)
137 , m_ProfilingEnabled(false)
138 , m_ExportEnabled(false)
139 , m_AllowExpandedDims(false)
143 ModelOptions modelOptions = {},
bool exportEnabled =
false,
bool debugToFile =
false)
144 : m_ReduceFp32ToFp16(reduceFp32ToFp16)
146 , m_DebugToFile(debugToFile)
147 , m_ReduceFp32ToBf16(reduceFp32ToBf16)
149 , m_ImportEnabled(importEnabled)
150 , m_ModelOptions(modelOptions)
151 , m_ProfilingEnabled(
false)
152 , m_ExportEnabled(exportEnabled)
153 , m_AllowExpandedDims(
false)
155 if (m_ReduceFp32ToFp16 && m_ReduceFp32ToBf16)
163 bool importEnabled =
false,
ModelOptions modelOptions = {},
bool exportEnabled =
false,
164 bool debugToFile =
false,
bool allowExpandedDims =
false)
165 : m_ReduceFp32ToFp16(reduceFp32ToFp16)
167 , m_DebugToFile(debugToFile)
168 , m_ReduceFp32ToBf16(reduceFp32ToBf16)
169 , m_shapeInferenceMethod(shapeInferenceMethod)
170 , m_ImportEnabled(importEnabled)
171 , m_ModelOptions(modelOptions)
172 , m_ProfilingEnabled(
false)
173 , m_ExportEnabled(exportEnabled)
174 , m_AllowExpandedDims(allowExpandedDims)
176 if (m_ReduceFp32ToFp16 && m_ReduceFp32ToBf16)
184 std::stringstream stream;
185 stream <<
"OptimizerOptions: \n";
186 stream <<
"\tReduceFp32ToFp16: " << m_ReduceFp32ToFp16 <<
"\n";
187 stream <<
"\tReduceFp32ToBf16: " << m_ReduceFp32ToBf16 <<
"\n";
188 stream <<
"\tDebug: " << m_Debug <<
"\n";
189 stream <<
"\tDebug to file: " << m_DebugToFile <<
"\n";
190 stream <<
"\tShapeInferenceMethod: " <<
192 stream <<
"\tImportEnabled: " << m_ImportEnabled <<
"\n";
193 stream <<
"\tExportEnabled: " << m_ExportEnabled <<
"\n";
194 stream <<
"\tProfilingEnabled: " << m_ProfilingEnabled <<
"\n";
195 stream <<
"\tAllowExpandedDims: " << m_AllowExpandedDims <<
"\n";
197 stream <<
"\tModelOptions: \n";
198 for (
auto optionsGroup : m_ModelOptions)
200 for (
size_t i=0; i < optionsGroup.GetOptionCount(); i++)
203 stream <<
"\t\tBackend: " << optionsGroup.GetBackendId() <<
"\n" 204 <<
"\t\t\tOption: " << option.
GetName() <<
"\n" 253 using INetworkPtr = std::unique_ptr<INetwork, void(*)(INetwork* network)>;
266 static void Destroy(
INetwork* network);
282 const char* name =
nullptr);
294 const char* name =
nullptr);
304 const char* name =
nullptr);
311 const char* name =
nullptr);
318 const char* name =
nullptr);
325 const char* name =
nullptr);
332 const char* name =
nullptr);
346 const char* name =
nullptr);
353 const char* name =
nullptr);
360 const char* name =
nullptr);
385 const char* name =
nullptr);
392 const char* name =
nullptr);
399 const char* name =
nullptr);
406 const char* name =
nullptr);
413 const char* name =
nullptr);
424 const char* name =
nullptr);
431 const char* name =
nullptr);
438 const char* name =
nullptr);
453 const char* name =
nullptr);
463 const char* name =
nullptr);
492 const char* name =
nullptr);
504 const char* name =
nullptr);
511 const char* name =
nullptr);
518 const char* name =
nullptr);
526 const char* name =
nullptr);
533 const char* name =
nullptr);
543 const char* name =
nullptr);
550 const char* name =
nullptr);
562 const char* name =
nullptr);
569 const char* name =
nullptr);
590 const char* name =
nullptr);
620 const char* name =
nullptr);
632 const char* name =
nullptr);
644 const char* name =
nullptr);
670 const char* name =
nullptr);
677 const char* name =
nullptr);
684 const char* name =
nullptr);
693 const char* name =
nullptr);
700 const char* name =
nullptr);
709 const char* name =
nullptr);
716 const char* name =
nullptr);
725 const char* name =
nullptr);
732 const char* name =
nullptr);
739 const char* name =
nullptr);
741 void ExecuteStrategy(
IStrategy& strategy)
const;
746 friend void VisitLayersTopologically(
const INetwork* inputNetwork,
IStrategy& strategy);
747 friend class TestConnectionPreservation;
750 const std::vector<BackendId>& backendPreferences,
753 Optional<std::vector<std::string>&> messages);
760 namespace experimental
762 class AsyncNetworkImpl;
776 Status SerializeToDot(std::ostream& stream)
const;
778 arm::pipe::ProfilingGuid GetGuid()
const;
781 size_t GetNumOutputs()
const;
783 void ExecuteStrategy(
IStrategy& strategy)
const;
792 const std::shared_ptr<IProfiler>& GetProfiler()
const;
797 friend class experimental::AsyncNetworkImpl;
803 const std::vector<BackendId>& backendPreferences,
806 Optional<std::vector<std::string>&> messages);
808 const std::vector<BackendId>& backendPreferences,
811 Optional<std::vector<std::string>&> messages);
828 const std::vector<BackendId>& backendPreferences,
843 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.
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 ResizeDescriptor for the ResizeLayer.
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
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.
OptimizerOptions(bool reduceFp32ToFp16, bool debug, bool reduceFp32ToBf16=false, ShapeInferenceMethod shapeInferenceMethod=armnn::ShapeInferenceMethod::ValidateOnly, bool importEnabled=false, ModelOptions modelOptions={}, bool exportEnabled=false, bool debugToFile=false, bool allowExpandedDims=false)
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
OptimizerOptions(bool reduceFp32ToFp16, bool debug, bool reduceFp32ToBf16, bool importEnabled, ModelOptions modelOptions={}, bool exportEnabled=false, bool debugToFile=false)
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)
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.
A ChannelShuffleDescriptor for the ChannelShuffle operator.
A SoftmaxDescriptor for the SoftmaxLayer.
ShapeInferenceMethod
The ShapeInferenceMethod modify how the output shapes are treated.
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
A FillDescriptor for the FillLayer.
A BatchNormalizationDescriptor for the BatchNormalizationLayer.
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
A PermuteDescriptor for the PermuteLayer.
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below...