43 virtual unsigned int GetNumConnections()
const = 0;
47 virtual void SetTensorInfo(
const TensorInfo& tensorInfo) = 0;
49 virtual bool IsTensorInfoSet()
const = 0;
54 virtual unsigned int CalculateIndexOnOwner()
const = 0;
56 virtual LayerGuid GetOwningLayerGuid()
const = 0;
70 virtual const char* GetName()
const = 0;
73 virtual unsigned int GetNumInputSlots()
const = 0;
76 virtual unsigned int GetNumOutputSlots()
const = 0;
79 virtual const IInputSlot& GetInputSlot(
unsigned int index)
const = 0;
82 virtual IInputSlot& GetInputSlot(
unsigned int index) = 0;
85 virtual const IOutputSlot& GetOutputSlot(
unsigned int index)
const = 0;
88 virtual IOutputSlot& GetOutputSlot(
unsigned int index) = 0;
91 virtual std::vector<TensorShape> InferOutputShapes(
const std::vector<TensorShape>& inputShapes)
const = 0;
101 "Accept function is deprecated. Use IStrategy in combination with " 102 "ExecuteStrategy instead, which is an ABI/API stable version of the " 105 virtual void Accept(ILayerVisitor& visitor)
const = 0;
109 virtual void ExecuteStrategy(
IStrategy& strategy)
const = 0;
124 using ConstantTensors = std::vector<std::reference_wrapper<std::shared_ptr<ConstTensorHandle>>>;
140 : m_ReduceFp32ToFp16(false)
142 , m_ReduceFp32ToBf16(false)
144 , m_ImportEnabled(false)
146 , m_ProfilingEnabled(false)
151 : m_ReduceFp32ToFp16(reduceFp32ToFp16)
153 , m_ReduceFp32ToBf16(reduceFp32ToBf16)
155 , m_ImportEnabled(importEnabled)
156 , m_ModelOptions(modelOptions)
157 , m_ProfilingEnabled(
false)
159 if (m_ReduceFp32ToFp16 && m_ReduceFp32ToBf16)
167 bool importEnabled =
false,
ModelOptions modelOptions = {})
168 : m_ReduceFp32ToFp16(reduceFp32ToFp16)
170 , m_ReduceFp32ToBf16(reduceFp32ToBf16)
171 , m_shapeInferenceMethod(shapeInferenceMethod)
172 , m_ImportEnabled(importEnabled)
173 , m_ModelOptions(modelOptions)
174 , m_ProfilingEnabled(
false)
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 <<
"\tShapeInferenceMethod: " <<
191 stream <<
"\tImportEnabled: " << m_ImportEnabled <<
"\n";
192 stream <<
"\tProfilingEnabled: " << m_ProfilingEnabled <<
"\n";
194 stream <<
"\tModelOptions: \n";
195 for (
auto optionsGroup : m_ModelOptions)
197 for (
size_t i=0; i < optionsGroup.GetOptionCount(); i++)
200 stream <<
"\t\tBackend: " << optionsGroup.GetBackendId() <<
"\n" 201 <<
"\t\t\tOption: " << option.
GetName() <<
"\n" 241 using INetworkPtr = std::unique_ptr<INetwork, void(*)(INetwork* network)>;
254 static void Destroy(
INetwork* network);
270 const char* name =
nullptr);
282 const char* name =
nullptr);
292 const char* name =
nullptr);
299 const char* name =
nullptr);
311 const char* name =
nullptr);
316 const char* name =
nullptr);
322 const char* name =
nullptr);
329 const char* name =
nullptr);
336 const char* name =
nullptr);
343 const char* name =
nullptr);
356 const char* name =
nullptr);
370 const char* name =
nullptr);
377 const char* name =
nullptr);
384 const char* name =
nullptr);
409 const char* name =
nullptr);
416 const char* name =
nullptr);
423 const char* name =
nullptr);
430 const char* name =
nullptr);
437 const char* name =
nullptr);
448 const char* name =
nullptr);
455 const char* name =
nullptr);
462 const char* name =
nullptr);
477 const char* name =
nullptr);
487 const char* name =
nullptr);
516 const char* name =
nullptr);
528 const char* name =
nullptr);
535 const char* name =
nullptr);
542 const char* name =
nullptr);
550 const char* name =
nullptr);
557 const char* name =
nullptr);
567 const char* name =
nullptr);
574 const char* name =
nullptr);
586 const char* name =
nullptr);
593 const char* name =
nullptr);
614 const char* name =
nullptr);
644 const char* name =
nullptr);
656 const char* name =
nullptr);
668 const char* name =
nullptr);
694 const char* name =
nullptr);
701 const char* name =
nullptr);
708 const char* name =
nullptr);
717 const char* name =
nullptr);
724 const char* name =
nullptr);
733 const char* name =
nullptr);
740 const char* name =
nullptr);
749 const char* name =
nullptr);
756 const char* name =
nullptr);
763 "Accept function is deprecated. Use IStrategy in combination with " 764 "ExecuteStrategy instead, which is an ABI/API stable version of the " 767 void Accept(ILayerVisitor& visitor)
const;
770 void ExecuteStrategy(
IStrategy& strategy)
const;
775 friend void VisitLayersTopologically(
const INetwork* inputNetwork,
IStrategy& strategy);
776 friend class TestConnectionPreservation;
779 const std::vector<BackendId>& backendPreferences,
782 Optional<std::vector<std::string>&> messages);
789 namespace experimental
791 class AsyncNetworkImpl;
805 Status SerializeToDot(std::ostream& stream)
const;
807 arm::pipe::ProfilingGuid GetGuid()
const;
810 size_t GetNumOutputs()
const;
819 const std::shared_ptr<IProfiler>& GetProfiler()
const;
824 friend class experimental::AsyncNetworkImpl;
830 const std::vector<BackendId>& backendPreferences,
833 Optional<std::vector<std::string>&> messages);
835 const std::vector<BackendId>& backendPreferences,
838 Optional<std::vector<std::string>&> messages);
855 const std::vector<BackendId>& backendPreferences,
870 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.
#define ARMNN_NO_DEPRECATE_WARN_BEGIN
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 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.
#define ARMNN_NO_DEPRECATE_WARN_END
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 Pooling3dDescriptor for the Pooling3dLayer.
Graph & GetGraphForTesting(IOptimizedNetwork *optNet)
A SpaceToBatchNdDescriptor for the SpaceToBatchNdLayer.
OptimizerOptions(bool reduceFp32ToFp16, bool debug, bool reduceFp32ToBf16, bool importEnabled, ModelOptions modelOptions={})
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.
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
OptimizerOptions(bool reduceFp32ToFp16, bool debug, bool reduceFp32ToBf16=false, ShapeInferenceMethod shapeInferenceMethod=armnn::ShapeInferenceMethod::ValidateOnly, bool importEnabled=false, ModelOptions modelOptions={})
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...