From e4f39fd1f2718c40d034cd076406ef65766775d6 Mon Sep 17 00:00:00 2001 From: Keith Davis Date: Thu, 10 Jun 2021 16:27:30 +0100 Subject: Refactor Network.hpp to be in alphabetical order Signed-off-by: Keith Davis Change-Id: Ib31d239ce0b85639e1984ed91edccdbdeb12a57e --- src/armnn/Network.hpp | 208 +++++++++++++++++++++++++------------------------- 1 file changed, 105 insertions(+), 103 deletions(-) diff --git a/src/armnn/Network.hpp b/src/armnn/Network.hpp index e07075fbb5..6f9be5635a 100644 --- a/src/armnn/Network.hpp +++ b/src/armnn/Network.hpp @@ -25,7 +25,7 @@ namespace armnn { class Graph; -using NetworkImplPtr = std::unique_ptr; +using NetworkImplPtr = std::unique_ptr; /// Private implementation of INetwork. class NetworkImpl @@ -34,15 +34,31 @@ public: NetworkImpl(NetworkOptions networkOptions = {}); ~NetworkImpl(); - const Graph& GetGraph() const { return *m_Graph; } + const Graph& GetGraph() const + { return *m_Graph; } Status PrintGraph(); - IConnectableLayer* AddInputLayer(LayerBindingId id, const char* name=nullptr); + IConnectableLayer* AddInputLayer(LayerBindingId id, const char* name = nullptr); + + ARMNN_DEPRECATED_MSG("Use AddElementwiseUnaryLayer instead") + IConnectableLayer* AddAbsLayer(const char* name = nullptr); + + IConnectableLayer* AddActivationLayer(const ActivationDescriptor& activationDescriptor, + const char* name = nullptr); + + IConnectableLayer* AddAdditionLayer(const char* name = nullptr); IConnectableLayer* AddArgMinMaxLayer(const ArgMinMaxDescriptor& desc, const char* name = nullptr); + IConnectableLayer* AddBatchNormalizationLayer(const BatchNormalizationDescriptor& desc, + const ConstTensor& mean, + const ConstTensor& variance, + const ConstTensor& beta, + const ConstTensor& gamma, + const char* name = nullptr); + IConnectableLayer* AddBatchToSpaceNdLayer(const BatchToSpaceNdDescriptor& batchToSpaceNdDescriptor, const char* name = nullptr); @@ -70,6 +86,8 @@ public: const ConstTensor& biases, const char* name = nullptr); + IConnectableLayer* AddConstantLayer(const ConstTensor& input, const char* name = nullptr); + IConnectableLayer* AddDepthToSpaceLayer(const DepthToSpaceDescriptor& depthToSpaceDescriptor, const char* name = nullptr); @@ -99,12 +117,21 @@ public: const ConstTensor& anchors, const char* name = nullptr); + IConnectableLayer* AddDivisionLayer(const char* name = nullptr); + IConnectableLayer* AddElementwiseUnaryLayer(const ElementwiseUnaryDescriptor& elementwiseUnaryDescriptor, const char* name = nullptr); + ARMNN_DEPRECATED_MSG("Use AddComparisonLayer instead") + IConnectableLayer* AddEqualLayer(const char* name = nullptr); + + IConnectableLayer* AddMergeLayer(const char* name = nullptr); + IConnectableLayer* AddFillLayer(const FillDescriptor& fillDescriptor, const char* name = nullptr); + IConnectableLayer* AddFloorLayer(const char* name = nullptr); + IConnectableLayer* AddFullyConnectedLayer(const FullyConnectedDescriptor& fullyConnectedDescriptor, const Optional& weights, const Optional& biases, @@ -132,46 +159,66 @@ public: IConnectableLayer* AddGatherLayer(const GatherDescriptor& gatherDescriptor, const char* name = nullptr); - IConnectableLayer* AddPermuteLayer(const PermuteDescriptor& permuteDescriptor, - const char* name = nullptr); + ARMNN_DEPRECATED_MSG("Use AddComparisonLayer instead") + IConnectableLayer* AddGreaterLayer(const char* name = nullptr); - IConnectableLayer* AddPooling2dLayer(const Pooling2dDescriptor& pooling2dDescriptor, - const char* name = nullptr); + IConnectableLayer* AddInstanceNormalizationLayer(const InstanceNormalizationDescriptor& desc, + const char* name = nullptr); - IConnectableLayer* AddActivationLayer(const ActivationDescriptor& activationDescriptor, - const char* name = nullptr); + IConnectableLayer* AddL2NormalizationLayer(const L2NormalizationDescriptor& desc, + const char* name = nullptr); - IConnectableLayer* AddNormalizationLayer(const NormalizationDescriptor& normalizationDescriptor, - const char* name = nullptr); + IConnectableLayer* AddLogSoftmaxLayer(const LogSoftmaxDescriptor& logSoftmaxDescriptor, + const char* name = nullptr); - IConnectableLayer* AddSliceLayer(const SliceDescriptor& sliceDescriptor, const char* name = nullptr); + IConnectableLayer* AddLogicalBinaryLayer(const LogicalBinaryDescriptor& logicalBinaryDescriptor, + const char* name = nullptr); - IConnectableLayer* AddSoftmaxLayer(const SoftmaxDescriptor& softmaxDescriptor, - const char* name = nullptr); + IConnectableLayer* AddLstmLayer(const LstmDescriptor& descriptor, + const LstmInputParams& params, + const char* name = nullptr); - IConnectableLayer* AddSplitterLayer(const ViewsDescriptor& splitterDescriptor, - const char* name = nullptr); + IConnectableLayer* AddMaximumLayer(const char* name = nullptr); + + IConnectableLayer* AddMeanLayer(const MeanDescriptor& meanDescriptor, const char* name = nullptr); + + IConnectableLayer* AddMinimumLayer(const char* name = nullptr); ARMNN_DEPRECATED_MSG("Use AddConcatLayer instead") IConnectableLayer* AddMergerLayer(const MergerDescriptor& mergerDescriptor, const char* name = nullptr); - ARMNN_DEPRECATED_MSG("Use AddElementwiseUnaryLayer instead") - IConnectableLayer* AddAbsLayer(const char* name = nullptr); + IConnectableLayer* AddMultiplicationLayer(const char* name = nullptr); - IConnectableLayer* AddAdditionLayer(const char* name = nullptr); + IConnectableLayer* AddNormalizationLayer(const NormalizationDescriptor& normalizationDescriptor, + const char* name = nullptr); - IConnectableLayer* AddMultiplicationLayer(const char* name = nullptr); + IConnectableLayer* AddOutputLayer(LayerBindingId id, const char* name = nullptr); - IConnectableLayer* AddBatchNormalizationLayer(const BatchNormalizationDescriptor& desc, - const ConstTensor& mean, - const ConstTensor& variance, - const ConstTensor& beta, - const ConstTensor& gamma, - const char* name = nullptr); + IConnectableLayer* AddPadLayer(const PadDescriptor& padDescriptor, const char* name = nullptr); + + IConnectableLayer* AddPermuteLayer(const PermuteDescriptor& permuteDescriptor, + const char* name = nullptr); + + IConnectableLayer* AddPooling2dLayer(const Pooling2dDescriptor& pooling2dDescriptor, + const char* name = nullptr); + + IConnectableLayer* AddPreluLayer(const char* name = nullptr); + + IConnectableLayer* AddQuantizeLayer(const char* name = nullptr); + + IConnectableLayer* AddQLstmLayer(const QLstmDescriptor& descriptor, + const LstmInputParams& params, + const char* name = nullptr); + + IConnectableLayer* AddQuantizedLstmLayer(const QuantizedLstmInputParams& params, + const char* name = nullptr); IConnectableLayer* AddRankLayer(const char* name = nullptr); + IConnectableLayer* AddReduceLayer(const ReduceDescriptor& reduceDescriptor, + const char* name = nullptr); + ARMNN_DEPRECATED_MSG("Use AddResizeLayer instead") IConnectableLayer* AddResizeBilinearLayer(const ResizeBilinearDescriptor& resizeDesc, const char* name = nullptr); @@ -179,69 +226,41 @@ public: IConnectableLayer* AddResizeLayer(const ResizeDescriptor& resizeDescriptor, const char* name = nullptr); - IConnectableLayer* AddReduceLayer(const ReduceDescriptor& reduceDescriptor, - const char* name = nullptr); - - IConnectableLayer* AddInstanceNormalizationLayer(const InstanceNormalizationDescriptor& desc, - const char* name = nullptr); + IConnectableLayer* AddReshapeLayer(const ReshapeDescriptor& reshapeDescriptor, + const char* name = nullptr); - IConnectableLayer* AddL2NormalizationLayer(const L2NormalizationDescriptor& desc, - const char* name = nullptr); + ARMNN_DEPRECATED_MSG("Use AddElementwiseUnaryLayer instead") + IConnectableLayer* AddRsqrtLayer(const char* name = nullptr); - IConnectableLayer* AddLogSoftmaxLayer(const LogSoftmaxDescriptor& logSoftmaxDescriptor, - const char* name = nullptr); + IConnectableLayer* AddShapeLayer(const char* name = nullptr); - IConnectableLayer* AddConstantLayer(const ConstTensor& input, const char* name = nullptr); + IConnectableLayer* AddSliceLayer(const SliceDescriptor& sliceDescriptor, const char* name = nullptr); - IConnectableLayer* AddReshapeLayer(const ReshapeDescriptor& reshapeDescriptor, + IConnectableLayer* AddSoftmaxLayer(const SoftmaxDescriptor& softmaxDescriptor, const char* name = nullptr); + IConnectableLayer* AddSplitterLayer(const ViewsDescriptor& splitterDescriptor, + const char* name = nullptr); + IConnectableLayer* AddSpaceToBatchNdLayer(const SpaceToBatchNdDescriptor& spaceToBatchNdDescriptor, const char* name = nullptr); IConnectableLayer* AddSpaceToDepthLayer(const SpaceToDepthDescriptor& spaceToDepthDescriptor, const char* name = nullptr); - IConnectableLayer* AddFloorLayer(const char* name = nullptr); - - IConnectableLayer* AddOutputLayer(LayerBindingId id, const char* name = nullptr); - - IConnectableLayer* AddLstmLayer(const LstmDescriptor& descriptor, - const LstmInputParams& params, - const char* name = nullptr); - - IConnectableLayer* AddDivisionLayer(const char* name = nullptr); - - IConnectableLayer* AddSubtractionLayer(const char* name = nullptr); - - IConnectableLayer* AddMaximumLayer(const char* name = nullptr); - - IConnectableLayer* AddMeanLayer(const MeanDescriptor& meanDescriptor, const char* name = nullptr); - - IConnectableLayer* AddPadLayer(const PadDescriptor& padDescriptor, const char* name = nullptr); + IConnectableLayer* AddStackLayer(const StackDescriptor& stackDescriptor, + const char* name = nullptr); - IConnectableLayer* AddQuantizeLayer(const char* name = nullptr); + IConnectableLayer* AddStandInLayer(const StandInDescriptor& descriptor, + const char* name = nullptr); IConnectableLayer* AddStridedSliceLayer(const StridedSliceDescriptor& stridedSliceDescriptor, const char* name = nullptr); - IConnectableLayer* AddMinimumLayer(const char* name = nullptr); - - ARMNN_DEPRECATED_MSG("Use AddComparisonLayer instead") - IConnectableLayer* AddGreaterLayer(const char* name = nullptr); - - ARMNN_DEPRECATED_MSG("Use AddComparisonLayer instead") - IConnectableLayer* AddEqualLayer(const char* name = nullptr); - - ARMNN_DEPRECATED_MSG("Use AddElementwiseUnaryLayer instead") - IConnectableLayer* AddRsqrtLayer(const char* name = nullptr); - - IConnectableLayer* AddMergeLayer(const char* name = nullptr); + IConnectableLayer* AddSubtractionLayer(const char* name = nullptr); IConnectableLayer* AddSwitchLayer(const char* name = nullptr); - IConnectableLayer* AddPreluLayer(const char* name = nullptr); - IConnectableLayer* AddTransposeConvolution2dLayer(const TransposeConvolution2dDescriptor& descriptor, const ConstTensor& weights, const Optional& biases, @@ -250,50 +269,31 @@ public: IConnectableLayer* AddTransposeLayer(const TransposeDescriptor& transposeDescriptor, const char* name = nullptr); - IConnectableLayer* AddShapeLayer(const char* name = nullptr); - - IConnectableLayer* AddStackLayer(const StackDescriptor& stackDescriptor, - const char* name = nullptr); - - IConnectableLayer* AddStandInLayer(const StandInDescriptor& descriptor, - const char* name = nullptr); - - IConnectableLayer* AddQLstmLayer(const QLstmDescriptor& descriptor, - const LstmInputParams& params, - const char* name = nullptr); - - IConnectableLayer* AddQuantizedLstmLayer(const QuantizedLstmInputParams& params, - const char* name = nullptr); - - IConnectableLayer* AddLogicalBinaryLayer(const LogicalBinaryDescriptor& logicalBinaryDescriptor, - const char* name = nullptr); - void Accept(ILayerVisitor& visitor) const; void ExecuteStrategy(IStrategy& strategy) const; private: - IConnectableLayer* AddFullyConnectedLayerImpl(const FullyConnectedDescriptor& fullyConnectedDescriptor, - const Optional& weights, - const Optional& biases, - const char* name); - IConnectableLayer* AddConvolution2dLayerImpl(const Convolution2dDescriptor& convolution2dDescriptor, const ConstTensor& weights, const Optional& biases, const char* name); - IConnectableLayer* AddDepthwiseConvolution2dLayerImpl( - const DepthwiseConvolution2dDescriptor& convolution2dDescriptor, - const ConstTensor& weights, - const Optional& biases, - const char* name); + IConnectableLayer* AddDepthwiseConvolution2dLayerImpl(const DepthwiseConvolution2dDescriptor& conv2dDescriptor, + const ConstTensor& weights, + const Optional& biases, + const char* name); + + IConnectableLayer* AddFullyConnectedLayerImpl(const FullyConnectedDescriptor& fullyConnectedDescriptor, + const Optional& weights, + const Optional& biases, + const char* name); bool GetShapeInferenceMethod(); NetworkOptions m_NetworkOptions; std::unique_ptr m_Graph; - ModelOptions m_ModelOptions; + ModelOptions m_ModelOptions; }; struct OptimizationResult @@ -302,17 +302,19 @@ struct OptimizationResult bool m_Error; OptimizationResult(bool warning, bool error) - : m_Warning(warning) - , m_Error(error) + : m_Warning(warning), m_Error(error) {} OptimizationResult() : OptimizationResult(false, false) {} - bool IsOk() const { return !m_Warning && !m_Error; } - bool IsWarningOnly() const { return m_Warning && !m_Error; } - bool IsError() const { return m_Error; } + bool IsOk() const + { return !m_Warning && !m_Error; } + bool IsWarningOnly() const + { return m_Warning && !m_Error; } + bool IsError() const + { return m_Error; } }; -- cgit v1.2.1