From 35052ae3f44d24cd71f437a2011c5032d34c94a7 Mon Sep 17 00:00:00 2001 From: Conor Kennedy Date: Fri, 21 Dec 2018 14:38:36 +0000 Subject: IVGCVSW-59 Add documentation to the public API * Add documentation to the Descriptors * Add documentation to the layers Change-Id: I5e0849753903565227fd47d329a600fd90b2feb9 --- src/armnn/layers/ActivationLayer.hpp | 14 ++++++++- src/armnn/layers/AdditionLayer.hpp | 12 +++++++- src/armnn/layers/BatchNormalizationLayer.hpp | 20 ++++++++++++ src/armnn/layers/BatchToSpaceNdLayer.hpp | 18 +++++++++++ src/armnn/layers/ConstantLayer.hpp | 22 +++++++++++-- src/armnn/layers/ConvertFp16ToFp32Layer.hpp | 13 ++++++++ src/armnn/layers/ConvertFp32ToFp16Layer.hpp | 13 ++++++++ src/armnn/layers/Convolution2dLayer.hpp | 22 +++++++++++++ src/armnn/layers/DebugLayer.hpp | 14 +++++++++ src/armnn/layers/DepthwiseConvolution2dLayer.hpp | 22 +++++++++++++ src/armnn/layers/DivisionLayer.hpp | 11 +++++++ src/armnn/layers/ElementwiseBaseLayer.hpp | 19 ++++++++++-- src/armnn/layers/EqualLayer.hpp | 12 +++++++- src/armnn/layers/FakeQuantizationLayer.hpp | 14 +++++++++ src/armnn/layers/FloorLayer.hpp | 13 ++++++++ src/armnn/layers/FullyConnectedLayer.hpp | 23 ++++++++++++++ src/armnn/layers/GreaterLayer.hpp | 11 +++++++ src/armnn/layers/InputLayer.hpp | 14 +++++++++ src/armnn/layers/L2NormalizationLayer.hpp | 16 +++++++++- src/armnn/layers/LstmLayer.hpp | 39 ++++++++++++++++++++++++ src/armnn/layers/MaximumLayer.hpp | 10 ++++++ src/armnn/layers/MeanLayer.hpp | 14 +++++++++ src/armnn/layers/MemCopyLayer.hpp | 17 +++++++++-- src/armnn/layers/MergerLayer.hpp | 24 +++++++++++++++ src/armnn/layers/MinimumLayer.hpp | 11 +++++++ src/armnn/layers/MultiplicationLayer.hpp | 11 +++++++ src/armnn/layers/NormalizationLayer.hpp | 14 +++++++++ src/armnn/layers/OutputLayer.hpp | 19 ++++++++++++ src/armnn/layers/PadLayer.hpp | 14 +++++++++ src/armnn/layers/PermuteLayer.hpp | 26 ++++++++++++++++ src/armnn/layers/Pooling2dLayer.hpp | 19 ++++++++++++ src/armnn/layers/ReshapeLayer.hpp | 24 ++++++++++++++- src/armnn/layers/ResizeBilinearLayer.hpp | 23 ++++++++++++-- src/armnn/layers/SoftmaxLayer.hpp | 14 +++++++++ src/armnn/layers/SpaceToBatchNdLayer.hpp | 18 +++++++++++ src/armnn/layers/SplitterLayer.hpp | 24 +++++++++++++++ src/armnn/layers/StridedSliceLayer.hpp | 18 +++++++++++ src/armnn/layers/SubtractionLayer.hpp | 11 +++++++ 38 files changed, 639 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/armnn/layers/ActivationLayer.hpp b/src/armnn/layers/ActivationLayer.hpp index 5ea8c4ee95..390955a35d 100644 --- a/src/armnn/layers/ActivationLayer.hpp +++ b/src/armnn/layers/ActivationLayer.hpp @@ -8,19 +8,31 @@ namespace armnn { - +/// This layer represents an activation operation with the specified activation function. class ActivationLayer : public LayerWithParameters { public: + /// Makes a workload for the Activation type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. ActivationLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) will lead to a valid configuration of @ref ActivationLayer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create an ActivationLayer. + /// @param [in] param ActivationDescriptor to configure the activation operation. + /// @param [in] name Optional name for the layer. ActivationLayer(const ActivationDescriptor ¶m, const char* name); + + /// Default destructor ~ActivationLayer() = default; }; diff --git a/src/armnn/layers/AdditionLayer.hpp b/src/armnn/layers/AdditionLayer.hpp index 9cdf09fb4e..4a6b8d9f1a 100644 --- a/src/armnn/layers/AdditionLayer.hpp +++ b/src/armnn/layers/AdditionLayer.hpp @@ -9,17 +9,27 @@ namespace armnn { - +/// This layer represents an addition operation. class AdditionLayer : public ElementwiseBaseLayer { public: + /// Makes a workload for the Addition type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. AdditionLayer* Clone(Graph& graph) const override; protected: + /// Constructor to create an AdditionLayer. + /// @param [in] name Optional name for the layer. AdditionLayer(const char* name); + + /// Default destructor ~AdditionLayer() = default; }; diff --git a/src/armnn/layers/BatchNormalizationLayer.hpp b/src/armnn/layers/BatchNormalizationLayer.hpp index 9ed15bebbf..02d8456a67 100644 --- a/src/armnn/layers/BatchNormalizationLayer.hpp +++ b/src/armnn/layers/BatchNormalizationLayer.hpp @@ -11,25 +11,45 @@ namespace armnn class ScopedCpuTensorHandle; +/// This layer represents a batch normalization operation. class BatchNormalizationLayer : public LayerWithParameters { public: + /// A unique pointer to store Mean values std::unique_ptr m_Mean; + /// A unique pointer to store Variance values std::unique_ptr m_Variance; + /// A unique pointer to store Beta values std::unique_ptr m_Beta; + /// A unique pointer to store Gamma values std::unique_ptr m_Gamma; + /// Makes a workload for the BatchNormalization type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. BatchNormalizationLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref BatchNormalizationLayer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create a BatchNormalizationLayer. + /// @param [in] param BatchNormalizationDescriptor to configure the batch normalization operation. + /// @param [in] name Optional name for the layer. BatchNormalizationLayer(const BatchNormalizationDescriptor& param, const char* name); + + /// Default destructor ~BatchNormalizationLayer() = default; + /// Retrieve the handles to the constant values stored by the layer. + /// @return A vector of the constant tensors stored by this layer. ConstantTensors GetConstantTensorsByRef() override; }; diff --git a/src/armnn/layers/BatchToSpaceNdLayer.hpp b/src/armnn/layers/BatchToSpaceNdLayer.hpp index eb5f979f3a..fc4dd71955 100644 --- a/src/armnn/layers/BatchToSpaceNdLayer.hpp +++ b/src/armnn/layers/BatchToSpaceNdLayer.hpp @@ -9,20 +9,38 @@ namespace armnn { +/// This layer represents a BatchToSpaceNd operation. class BatchToSpaceNdLayer : public LayerWithParameters { public: + /// Makes a workload for the BatchToSpaceNd type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. BatchToSpaceNdLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref BatchToSpaceNdLayer. void ValidateTensorShapesFromInputs() override; + /// By default returns inputShapes if the number of inputs are equal to number of outputs, + /// otherwise infers the output shapes from given input shapes and layer properties. + /// @param [in] inputShapes The input shapes layer has. + /// @return A vector to the inferred output shape. std::vector InferOutputShapes(const std::vector& inputShapes) const override; protected: + /// Constructor to create a BatchToSpaceNdLayer. + /// @param [in] param BatchToSpaceNdDescriptor to configure the BatchToSpaceNd operation. + /// @param [in] name Optional name for the layer. BatchToSpaceNdLayer(const BatchToSpaceNdDescriptor& param, const char* name); + + /// Default destructor ~BatchToSpaceNdLayer() = default; }; diff --git a/src/armnn/layers/ConstantLayer.hpp b/src/armnn/layers/ConstantLayer.hpp index a9c91110da..c3316b78b1 100644 --- a/src/armnn/layers/ConstantLayer.hpp +++ b/src/armnn/layers/ConstantLayer.hpp @@ -11,26 +11,44 @@ namespace armnn class ScopedCpuTensorHandle; +/// A layer that the constant data can be bound to. class ConstantLayer : public Layer { public: + /// Makes a workload for the Constant type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, - const IWorkloadFactory& factory) const override; + const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. ConstantLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref ConstantLayer void ValidateTensorShapesFromInputs() override; + /// By default returns inputShapes if the number of inputs are equal to number of outputs, + /// otherwise infers the output shapes from given input shapes and layer properties. + /// @param [in] inputShapes The input shapes layer has. + /// @return a vector to the inferred output shape. std::vector InferOutputShapes(const std::vector& inputShapes) const override; - // Free up the constant source data + /// Free up the constant source data stored by the layer. void ReleaseConstantData() override {}; std::unique_ptr m_LayerOutput; protected: + /// Constructor to create a ConstantLayer. + /// @param [in] name Optional name for the layer. ConstantLayer(const char* name); + + /// Default destructor ~ConstantLayer() = default; + /// Retrieve the handles to the constant values stored by the layer. ConstantTensors GetConstantTensorsByRef() override { return {m_LayerOutput}; } }; diff --git a/src/armnn/layers/ConvertFp16ToFp32Layer.hpp b/src/armnn/layers/ConvertFp16ToFp32Layer.hpp index bf28a84e6b..bdfc9814fd 100644 --- a/src/armnn/layers/ConvertFp16ToFp32Layer.hpp +++ b/src/armnn/layers/ConvertFp16ToFp32Layer.hpp @@ -10,18 +10,31 @@ namespace armnn { +/// This layer converts data type Float 16 to Float 32. class ConvertFp16ToFp32Layer : public Layer { public: + /// Makes a workload for the ConvertFp16ToFp32 type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. ConvertFp16ToFp32Layer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref ConvertFp16ToFp32Layer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create a ConvertFp16ToFp32Layer. + /// @param [in] name Optional name for the layer. ConvertFp16ToFp32Layer(const char* name); + + /// Default destructor ~ConvertFp16ToFp32Layer() = default; }; diff --git a/src/armnn/layers/ConvertFp32ToFp16Layer.hpp b/src/armnn/layers/ConvertFp32ToFp16Layer.hpp index 002719315a..524f974d77 100644 --- a/src/armnn/layers/ConvertFp32ToFp16Layer.hpp +++ b/src/armnn/layers/ConvertFp32ToFp16Layer.hpp @@ -9,18 +9,31 @@ namespace armnn { +/// This layer converts data type Float 32 to Float 16. class ConvertFp32ToFp16Layer : public Layer { public: + /// Makes a workload for the ConvertFp32ToFp16 type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. ConvertFp32ToFp16Layer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref ConvertFp32ToFp16Layer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create a ConvertFp32ToFp16Layer. + /// @param [in] name Optional name for the layer. ConvertFp32ToFp16Layer(const char* name); + + /// Default destructor ~ConvertFp32ToFp16Layer() = default; }; diff --git a/src/armnn/layers/Convolution2dLayer.hpp b/src/armnn/layers/Convolution2dLayer.hpp index 31a9117139..b812b1bece 100644 --- a/src/armnn/layers/Convolution2dLayer.hpp +++ b/src/armnn/layers/Convolution2dLayer.hpp @@ -11,25 +11,47 @@ namespace armnn class ScopedCpuTensorHandle; +/// This layer represents a convolution 2d operation. class Convolution2dLayer : public LayerWithParameters { public: + /// A unique pointer to store Weight values. std::unique_ptr m_Weight; + /// A unique pointer to store Bias values. std::unique_ptr m_Bias; + /// Makes a workload for the Convolution2d type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. Convolution2dLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref Convolution2dLayer. void ValidateTensorShapesFromInputs() override; + /// By default returns inputShapes if the number of inputs are equal to number of outputs, + /// otherwise infers the output shapes from given input shapes and layer properties. + /// @param [in] inputShapes The input shapes layer has. + /// @return A vector to the inferred output shape. std::vector InferOutputShapes(const std::vector& inputShapes) const override; protected: + /// Constructor to create a Convolution2dLayer. + /// @param [in] param Convolution2dDescriptor to configure the convolution2d operation. + /// @param [in] name Optional name for the layer. Convolution2dLayer(const Convolution2dDescriptor& param, const char* name); + + /// Default destructor ~Convolution2dLayer() = default; + /// Retrieve the handles to the constant values stored by the layer. + /// @return A vector of the constant tensors stored by this layer. ConstantTensors GetConstantTensorsByRef() override; }; diff --git a/src/armnn/layers/DebugLayer.hpp b/src/armnn/layers/DebugLayer.hpp index 6aaa271807..fc777a8bad 100644 --- a/src/armnn/layers/DebugLayer.hpp +++ b/src/armnn/layers/DebugLayer.hpp @@ -9,18 +9,32 @@ namespace armnn { +/// This layer visualizes the data flowing through the network. class DebugLayer : public LayerWithParameters { public: + /// Makes a workload for the Debug type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. DebugLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref DebugLayer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create a DebugLayer. + /// @param [in] param DebugDescriptor to configure the debug layer. + /// @param [in] name Optional name for the layer. DebugLayer(const DebugDescriptor& param, const char* name); + + /// Default destructor ~DebugLayer() = default; }; diff --git a/src/armnn/layers/DepthwiseConvolution2dLayer.hpp b/src/armnn/layers/DepthwiseConvolution2dLayer.hpp index ae91fde39a..9d5b658ec7 100644 --- a/src/armnn/layers/DepthwiseConvolution2dLayer.hpp +++ b/src/armnn/layers/DepthwiseConvolution2dLayer.hpp @@ -11,25 +11,47 @@ namespace armnn class ScopedCpuTensorHandle; +/// This layer represents a depthwise convolution 2d operation. class DepthwiseConvolution2dLayer : public LayerWithParameters { public: + /// A unique pointer to store Weight values. std::unique_ptr m_Weight; + /// A unique pointer to store Bias values. std::unique_ptr m_Bias; + /// Makes a workload for the DepthwiseConvolution2d type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. DepthwiseConvolution2dLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref DepthwiseConvolution2dLayer. void ValidateTensorShapesFromInputs() override; + /// By default returns inputShapes if the number of inputs are equal to number of outputs, + /// otherwise infers the output shapes from given input shapes and layer properties. + /// @param [in] inputShapes The input shapes layer has. + /// @return A vector to the inferred output shape. std::vector InferOutputShapes(const std::vector& inputShapes) const override; protected: + /// Constructor to create a DepthwiseConvolution2dLayer. + /// @param [in] param DepthwiseConvolution2dDescriptor to configure the depthwise convolution2d. + /// @param [in] name Optional name for the layer. DepthwiseConvolution2dLayer(const DepthwiseConvolution2dDescriptor& param, const char* name); + + /// Default destructor ~DepthwiseConvolution2dLayer() = default; + /// Retrieve the handles to the constant values stored by the layer. + /// @return A vector of the constant tensors stored by this layer. ConstantTensors GetConstantTensorsByRef() override; }; diff --git a/src/armnn/layers/DivisionLayer.hpp b/src/armnn/layers/DivisionLayer.hpp index 158f8e8b5d..e1dca2f9af 100644 --- a/src/armnn/layers/DivisionLayer.hpp +++ b/src/armnn/layers/DivisionLayer.hpp @@ -10,16 +10,27 @@ namespace armnn { +/// This layer represents a division operation. class DivisionLayer : public ElementwiseBaseLayer { public: + /// Makes a workload for the Division type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. DivisionLayer* Clone(Graph& graph) const override; protected: + /// Constructor to create a DivisionLayer. + /// @param [in] name Optional name for the layer. DivisionLayer(const char* name); + + /// Default destructor ~DivisionLayer() = default; }; diff --git a/src/armnn/layers/ElementwiseBaseLayer.hpp b/src/armnn/layers/ElementwiseBaseLayer.hpp index f0821ecfe9..5c2bbaa054 100644 --- a/src/armnn/layers/ElementwiseBaseLayer.hpp +++ b/src/armnn/layers/ElementwiseBaseLayer.hpp @@ -10,17 +10,30 @@ namespace armnn { -/// NOTE: this is an abstract class, it does not implement: -/// std::unique_ptr Layer::CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const = 0; -/// Layer* Clone(Graph& graph) const = 0; +/// NOTE: this is an abstract class to encapsulate the element wise operations, it does not implement: +/// std::unique_ptr Layer::CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const = 0; +/// Layer* Clone(Graph& graph) const = 0; class ElementwiseBaseLayer : public Layer { public: + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of the element wise operation. void ValidateTensorShapesFromInputs() override; + + /// By default returns inputShapes if the number of inputs are equal to number of outputs, + /// otherwise infers the output shapes from given input shapes and layer properties. + /// @param [in] inputShapes The input shapes layer has. + /// @return A vector to the inferred output shape. std::vector InferOutputShapes(const std::vector& inputShapes) const override; protected: + /// @param numInputSlots The number of input slots for the layer. + /// @param numOutputSlots The number of output slots for the layer. + /// @param type The layer type. + /// @param name Optional name for the layer. ElementwiseBaseLayer(unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, const char* name); + + /// Default destructor ~ElementwiseBaseLayer() = default; }; diff --git a/src/armnn/layers/EqualLayer.hpp b/src/armnn/layers/EqualLayer.hpp index 956ae3c1ab..198bae7f43 100644 --- a/src/armnn/layers/EqualLayer.hpp +++ b/src/armnn/layers/EqualLayer.hpp @@ -9,17 +9,27 @@ namespace armnn { - +/// This layer represents an equal operation. class EqualLayer : public ElementwiseBaseLayer { public: + /// Makes a workload for the Equal type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. EqualLayer* Clone(Graph& graph) const override; protected: + /// Constructor to create a EqualLayer. + /// @param [in] name Optional name for the layer. EqualLayer(const char* name); + + /// Default destructor ~EqualLayer() = default; }; diff --git a/src/armnn/layers/FakeQuantizationLayer.hpp b/src/armnn/layers/FakeQuantizationLayer.hpp index 60541aa654..5e7b5cbe7b 100644 --- a/src/armnn/layers/FakeQuantizationLayer.hpp +++ b/src/armnn/layers/FakeQuantizationLayer.hpp @@ -9,18 +9,32 @@ namespace armnn { +/// This layer represents a fake quantization operation. class FakeQuantizationLayer : public LayerWithParameters { public: + /// Makes a workload for the FakeQuantization type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. FakeQuantizationLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref FakeQuantizationLayer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create a FakeQuantizationLayer. + /// @param [in] param FakeQuantizationDescriptor to configure the fake quantization operation. + /// @param [in] name Optional name for the layer. FakeQuantizationLayer(const FakeQuantizationDescriptor& descriptor, const char* name); + + /// Default destructor ~FakeQuantizationLayer() = default; }; diff --git a/src/armnn/layers/FloorLayer.hpp b/src/armnn/layers/FloorLayer.hpp index bf9c25a3a2..546d1362f9 100644 --- a/src/armnn/layers/FloorLayer.hpp +++ b/src/armnn/layers/FloorLayer.hpp @@ -9,18 +9,31 @@ namespace armnn { +/// This layer represents a floor operation. class FloorLayer : public Layer { public: + /// Makes a workload for the Floor type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. FloorLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref FloorLayer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create a FloorLayer. + /// @param [in] name Optional name for the layer. FloorLayer(const char* name); + + /// Default destructor ~FloorLayer() = default; }; diff --git a/src/armnn/layers/FullyConnectedLayer.hpp b/src/armnn/layers/FullyConnectedLayer.hpp index ad0ac1c74e..0a404b7e49 100644 --- a/src/armnn/layers/FullyConnectedLayer.hpp +++ b/src/armnn/layers/FullyConnectedLayer.hpp @@ -11,24 +11,47 @@ namespace armnn class ScopedCpuTensorHandle; +/// This layer represents a fully connected operation. class FullyConnectedLayer : public LayerWithParameters { public: + /// A unique pointer to store Weight values. std::unique_ptr m_Weight; + /// A unique pointer to store Bias values. std::unique_ptr m_Bias; + /// Makes a workload for the FullyConnected type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. FullyConnectedLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref FullyConnectedLayer. void ValidateTensorShapesFromInputs() override; + + /// By default returns inputShapes if the number of inputs are equal to number of outputs, + /// otherwise infers the output shapes from given input shapes and layer properties. + /// @param [in] inputShapes The input shapes layer has. + /// @return A vector to the inferred output shape. std::vector InferOutputShapes(const std::vector& inputShapes) const override; protected: + /// Constructor to create a FullyConnectedLayer. + /// @param [in] param FullyConnectedDescriptor to configure the fully connected operation. + /// @param [in] name Optional name for the layer. FullyConnectedLayer(const FullyConnectedDescriptor& param, const char* name); + + /// Default destructor ~FullyConnectedLayer() = default; + /// Retrieve the handles to the constant values stored by the layer. + /// @return A vector of the constant tensors stored by this layer. ConstantTensors GetConstantTensorsByRef() override; }; diff --git a/src/armnn/layers/GreaterLayer.hpp b/src/armnn/layers/GreaterLayer.hpp index 9297a82da4..8b33f419b9 100644 --- a/src/armnn/layers/GreaterLayer.hpp +++ b/src/armnn/layers/GreaterLayer.hpp @@ -10,16 +10,27 @@ namespace armnn { +/// This layer represents a greater operation. class GreaterLayer : public ElementwiseBaseLayer { public: + /// Makes a workload for the Greater type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. GreaterLayer* Clone(Graph& graph) const override; protected: + /// Constructor to create a GreaterLayer. + /// @param [in] name Optional name for the layer. GreaterLayer(const char* name); + + /// Default destructor ~GreaterLayer() = default; }; diff --git a/src/armnn/layers/InputLayer.hpp b/src/armnn/layers/InputLayer.hpp index 6d71c69c58..1f6f245932 100644 --- a/src/armnn/layers/InputLayer.hpp +++ b/src/armnn/layers/InputLayer.hpp @@ -9,18 +9,32 @@ namespace armnn { +/// A layer user-provided data can be bound to (e.g. inputs, outputs). class InputLayer : public BindableLayer { public: + /// Makes a workload for the Input type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. InputLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref InputLayer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create an InputLayer. + /// @param id The layer binding id number. + /// @param name Optional name for the layer. InputLayer(LayerBindingId id, const char* name); + + /// Default destructor ~InputLayer() = default; }; diff --git a/src/armnn/layers/L2NormalizationLayer.hpp b/src/armnn/layers/L2NormalizationLayer.hpp index bf4d49e7c8..bae3d820ba 100644 --- a/src/armnn/layers/L2NormalizationLayer.hpp +++ b/src/armnn/layers/L2NormalizationLayer.hpp @@ -9,18 +9,32 @@ namespace armnn { +/// This layer represents a L2 normalization operation. class L2NormalizationLayer : public LayerWithParameters { public: + /// Makes a workload for the L2Normalization type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, - const IWorkloadFactory& factory) const override; + const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. L2NormalizationLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref L2NormalizationLayer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create a L2NormalizationLayer. + /// @param [in] param L2NormalizationDescriptor to configure the L2 normalization operation. + /// @param [in] name Optional name for the layer. L2NormalizationLayer(const L2NormalizationDescriptor& param, const char* name); + + /// Default destructor ~L2NormalizationLayer() = default; }; diff --git a/src/armnn/layers/LstmLayer.hpp b/src/armnn/layers/LstmLayer.hpp index 247fec389d..6004d9666b 100644 --- a/src/armnn/layers/LstmLayer.hpp +++ b/src/armnn/layers/LstmLayer.hpp @@ -13,37 +13,55 @@ class ScopedCpuTensorHandle; struct LstmOptCifgParameters { + /// A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units]. std::unique_ptr m_InputToInputWeights; + /// A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units]. std::unique_ptr m_RecurrentToInputWeights; + /// A unique pointer to represent 1D weights tensor with dimensions [num_units]. std::unique_ptr m_CellToInputWeights; + /// A unique pointer to represent 1D weights tensor with dimensions [num_units]. std::unique_ptr m_InputGateBias; }; struct LstmOptProjectionParameters { + /// A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units]. std::unique_ptr m_ProjectionWeights; + /// A unique pointer to represent 1D weights tensor with dimensions [output_size]. std::unique_ptr m_ProjectionBias; }; struct LstmOptPeepholeParameters { + /// A unique pointer to represent 1D weights tensor with dimensions [num_units]. std::unique_ptr m_CellToForgetWeights; + /// A unique pointer to represent 1D weights tensor with dimensions [num_units]. std::unique_ptr m_CellToOutputWeights; }; struct LstmBasicParameters { + /// A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units]. std::unique_ptr m_InputToForgetWeights; + /// A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units]. std::unique_ptr m_InputToCellWeights; + /// A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units]. std::unique_ptr m_InputToOutputWeights; + /// A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units]. std::unique_ptr m_RecurrentToForgetWeights; + /// A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units]. std::unique_ptr m_RecurrentToCellWeights; + /// A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units]. std::unique_ptr m_RecurrentToOutputWeights; + /// A unique pointer to represent 1D weights tensor with dimensions [num_units]. std::unique_ptr m_ForgetGateBias; + /// A unique pointer to represent 1D weights tensor with dimensions [num_units]. std::unique_ptr m_CellBias; + /// A unique pointer to represent 1D weights tensor with dimensions [num_units]. std::unique_ptr m_OutputGateBias; }; +/// This layer represents a LSTM operation. class LstmLayer : public LayerWithParameters { public: @@ -53,17 +71,38 @@ public: LstmOptProjectionParameters m_ProjectionParameters; LstmOptPeepholeParameters m_PeepholeParameters; + /// Makes a workload for the LSTM type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. LstmLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref LstmLayer. void ValidateTensorShapesFromInputs() override; + + /// By default returns inputShapes if the number of inputs are equal to number of outputs, + /// otherwise infers the output shapes from given input shapes and layer properties. + /// @param [in] inputShapes The input shapes layer has. + /// @return A vector to the inferred output shape. std::vector InferOutputShapes(const std::vector& inputShapes) const override; protected: + /// Constructor to create a LstmLayer. + /// @param [in] param LstmDescriptor to configure the lstm operation. + /// @param [in] name Optional name for the layer. LstmLayer(const LstmDescriptor& param, const char* name); + + /// Default destructor ~LstmLayer() = default; + /// Retrieve the handles to the constant values stored by the layer. + /// @return A vector of the constant tensors stored by this layer. Layer::ConstantTensors GetConstantTensorsByRef() override; }; diff --git a/src/armnn/layers/MaximumLayer.hpp b/src/armnn/layers/MaximumLayer.hpp index 18a4ed31e2..82ee6e8f55 100644 --- a/src/armnn/layers/MaximumLayer.hpp +++ b/src/armnn/layers/MaximumLayer.hpp @@ -10,17 +10,27 @@ namespace armnn { +/// This layer represents a maximum operation. class MaximumLayer : public ElementwiseBaseLayer { public: + /// Makes a workload for the Maximum type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. MaximumLayer* Clone(Graph& graph) const override; protected: + /// Constructor to create a MaximumLayer. + /// @param [in] name Optional name for the layer. MaximumLayer(const char* name); + /// Default destructor ~MaximumLayer() = default; }; diff --git a/src/armnn/layers/MeanLayer.hpp b/src/armnn/layers/MeanLayer.hpp index ecb92979d2..3896569aa8 100644 --- a/src/armnn/layers/MeanLayer.hpp +++ b/src/armnn/layers/MeanLayer.hpp @@ -10,18 +10,32 @@ namespace armnn { +/// This layer represents a mean operation. class MeanLayer : public LayerWithParameters { public: + /// Makes a workload for the Mean type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. MeanLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref MeanLayer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create a MeanLayer. + /// @param [in] param MeanDescriptor to configure the mean operation. + /// @param [in] name Optional name for the layer. MeanLayer(const MeanDescriptor& param, const char* name); + + /// Default destructor ~MeanLayer() = default; }; diff --git a/src/armnn/layers/MemCopyLayer.hpp b/src/armnn/layers/MemCopyLayer.hpp index 3d79ec3a0b..051b18f1fe 100644 --- a/src/armnn/layers/MemCopyLayer.hpp +++ b/src/armnn/layers/MemCopyLayer.hpp @@ -9,18 +9,31 @@ namespace armnn { +/// This layer represents a memory copy operation. class MemCopyLayer : public Layer { public: - virtual std::unique_ptr - CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Makes a workload for the MemCopy type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. + virtual std::unique_ptrCreateWorkload(const Graph& graph, + const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. MemCopyLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref MemCopyLayer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create a MemCopyLayer. + /// @param [in] name Optional name for the layer. MemCopyLayer(const char* name); + + /// Default destructor ~MemCopyLayer() = default; }; diff --git a/src/armnn/layers/MergerLayer.hpp b/src/armnn/layers/MergerLayer.hpp index 02f852c21c..f0bf62bd2f 100644 --- a/src/armnn/layers/MergerLayer.hpp +++ b/src/armnn/layers/MergerLayer.hpp @@ -9,20 +9,44 @@ namespace armnn { +/// This layer represents a merge operation. class MergerLayer : public LayerWithParameters { public: + /// Makes a workload for the Merger type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + + /// Set the outputs to be appropriate sub tensors of the input if sub tensors are supported + /// otherwise creates tensor handlers. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. virtual void CreateTensorHandles(Graph& graph, const IWorkloadFactory& factory) override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. MergerLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref MergerLayer. void ValidateTensorShapesFromInputs() override; + + /// By default returns inputShapes if the number of inputs are equal to number of outputs, + /// otherwise infers the output shapes from given input shapes and layer properties. + /// @param [in] inputShapes The input shapes layer has. + /// @return A vector to the inferred output shape. std::vector InferOutputShapes(const std::vector& inputShapes) const override; protected: + /// Constructor to create a MergerLayer. + /// @param [in] param OriginsDescriptor to configure the merger operation. + /// @param [in] name Optional name for the layer. MergerLayer(const OriginsDescriptor& param, const char* name); + + /// Default destructor ~MergerLayer() = default; }; diff --git a/src/armnn/layers/MinimumLayer.hpp b/src/armnn/layers/MinimumLayer.hpp index 43382374eb..3801c62622 100644 --- a/src/armnn/layers/MinimumLayer.hpp +++ b/src/armnn/layers/MinimumLayer.hpp @@ -10,16 +10,27 @@ namespace armnn { +/// This layer represents a minimum operation. class MinimumLayer : public ElementwiseBaseLayer { public: + /// Makes a workload for the Minimum type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. MinimumLayer* Clone(Graph& graph) const override; protected: + /// Constructor to create a MinimumLayer. + /// @param [in] name Optional name for the layer. MinimumLayer(const char* name); + + /// Default destructor ~MinimumLayer() = default; }; diff --git a/src/armnn/layers/MultiplicationLayer.hpp b/src/armnn/layers/MultiplicationLayer.hpp index 8a7bfdea39..9f15e3a4c6 100644 --- a/src/armnn/layers/MultiplicationLayer.hpp +++ b/src/armnn/layers/MultiplicationLayer.hpp @@ -10,16 +10,27 @@ namespace armnn { +/// This layer represents a multiplication operation. class MultiplicationLayer : public ElementwiseBaseLayer { public: + /// Makes a workload for the Multiplication type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. MultiplicationLayer* Clone(Graph& graph) const override; protected: + /// Constructor to create a MultiplicationLayer. + /// @param [in] name Optional name for the layer MultiplicationLayer(const char* name); + + /// Default destructor ~MultiplicationLayer() = default; }; diff --git a/src/armnn/layers/NormalizationLayer.hpp b/src/armnn/layers/NormalizationLayer.hpp index b67c0fbdd8..9fd78751f7 100644 --- a/src/armnn/layers/NormalizationLayer.hpp +++ b/src/armnn/layers/NormalizationLayer.hpp @@ -9,18 +9,32 @@ namespace armnn { +/// This layer represents a normalization operation. class NormalizationLayer : public LayerWithParameters { public: + /// Makes a workload for the Normalization type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. NormalizationLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref NormalizationLayer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create a NormalizationLayer. + /// @param [in] param NormalizationDescriptor to configure the normalization operation. + /// @param [in] name Optional name for the layer. NormalizationLayer(const NormalizationDescriptor& param, const char* name); + + /// Default destructor ~NormalizationLayer() = default; }; diff --git a/src/armnn/layers/OutputLayer.hpp b/src/armnn/layers/OutputLayer.hpp index 9f77e1fac4..080b30183b 100644 --- a/src/armnn/layers/OutputLayer.hpp +++ b/src/armnn/layers/OutputLayer.hpp @@ -9,22 +9,41 @@ namespace armnn { +/// A layer user-provided data can be bound to (e.g. inputs, outputs). class OutputLayer : public BindableLayer { public: + /// Returns nullptr for Output type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + + /// Set the outputs to be appropriate sub tensors of the input if sub tensors are supported + /// otherwise creates tensor handlers by default. Ignores parameters for Output type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. virtual void CreateTensorHandles(Graph& graph, const IWorkloadFactory& factory) override { boost::ignore_unused(graph, factory); } + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. OutputLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref OutputLayer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create an OutputLayer. + /// @param id The layer binding id number. + /// @param name Optional name for the layer. OutputLayer(LayerBindingId id, const char* name); + + /// Default destructor ~OutputLayer() = default; }; diff --git a/src/armnn/layers/PadLayer.hpp b/src/armnn/layers/PadLayer.hpp index e53a90c9de..569365a118 100644 --- a/src/armnn/layers/PadLayer.hpp +++ b/src/armnn/layers/PadLayer.hpp @@ -10,18 +10,32 @@ namespace armnn { +/// This layer represents a pad operation. class PadLayer : public LayerWithParameters { public: + /// Makes a workload for the Pad type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. PadLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref PadLayer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create a PadLayer. + /// @param [in] param PadDescriptor to configure the pad operation. + /// @param [in] name Optional name for the layer. PadLayer(const PadDescriptor& param, const char* name); + + /// Default destructor ~PadLayer() = default; }; diff --git a/src/armnn/layers/PermuteLayer.hpp b/src/armnn/layers/PermuteLayer.hpp index a32307dc10..e1f391a2ff 100644 --- a/src/armnn/layers/PermuteLayer.hpp +++ b/src/armnn/layers/PermuteLayer.hpp @@ -9,28 +9,49 @@ namespace armnn { +/// This layer represents a permutation operation. class PermuteLayer : public LayerWithParameters { public: + /// Makes a workload for the Permute type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. PermuteLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref PermuteLayer. void ValidateTensorShapesFromInputs() override; + + /// By default returns inputShapes if the number of inputs are equal to number of outputs, + /// otherwise infers the output shapes from given input shapes and layer properties. + /// @param [in] inputShapes The input shapes layer has. + /// @return A vector to the inferred output shape. std::vector InferOutputShapes(const std::vector& inputShapes) const override; + /// @return a permutation vector represents the memory layout of the tensor elements. const PermutationVector& GetPermutation() const { return m_Param.m_DimMappings; } + /// Indicates if the other layer received is inverse of this one. + /// @param other The other layer to be compared with. + /// @return true if other layer is inverse of this false otherwise. bool IsInverse(const Layer& other) const { return (other.GetType() == LayerType::Permute) && GetPermutation().IsInverse(boost::polymorphic_downcast(&other)->GetPermutation()); } + /// Indicates if the other layer received is equal to this one. + /// @param other The other layer to be compare with. + /// @return true if other layer is equal to this false otherwise. bool IsEqual(const Layer& other) const { return (other.GetType() == LayerType::Permute) && @@ -38,7 +59,12 @@ public: } protected: + /// Constructor to create a PermuteLayer. + /// @param [in] param PermuteDescriptor to configure the permute operation. + /// @param [in] name Optional name for the layer. PermuteLayer(const PermuteDescriptor& param, const char* name); + + /// Default destructor ~PermuteLayer() = default; }; diff --git a/src/armnn/layers/Pooling2dLayer.hpp b/src/armnn/layers/Pooling2dLayer.hpp index 50b8875ce8..ee6a6acee5 100644 --- a/src/armnn/layers/Pooling2dLayer.hpp +++ b/src/armnn/layers/Pooling2dLayer.hpp @@ -9,19 +9,38 @@ namespace armnn { +/// This layer represents a pooling 2d operation. class Pooling2dLayer : public LayerWithParameters { public: + /// Makes a workload for the Pooling2d type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. Pooling2dLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref Pooling2dLayer. void ValidateTensorShapesFromInputs() override; + + /// By default returns inputShapes if the number of inputs are equal to number of outputs, + /// otherwise infers the output shapes from given input shapes and layer properties. + /// @param [in] inputShapes The input shapes layer has. + /// @return A vector to the inferred output shape. std::vector InferOutputShapes(const std::vector& inputShapes) const override; protected: + /// Constructor to create a Pooling2dLayer. + /// @param [in] param Pooling2dDescriptor to configure the pooling2d operation. + /// @param [in] name Optional name for the layer. Pooling2dLayer(const Pooling2dDescriptor& param, const char* name); + + /// Default destructor ~Pooling2dLayer() = default; }; diff --git a/src/armnn/layers/ReshapeLayer.hpp b/src/armnn/layers/ReshapeLayer.hpp index c3afee3557..13e73be4e4 100644 --- a/src/armnn/layers/ReshapeLayer.hpp +++ b/src/armnn/layers/ReshapeLayer.hpp @@ -9,17 +9,34 @@ namespace armnn { +/// This layer represents a reshape operation. class ReshapeLayer : public LayerWithParameters { public: + /// Makes a workload for the Reshape type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, - const IWorkloadFactory& factory) const override; + const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. ReshapeLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref ReshapeLayer. void ValidateTensorShapesFromInputs() override; + + /// By default returns inputShapes if the number of inputs are equal to number of outputs, + /// otherwise infers the output shapes from given input shapes and layer properties. + /// @param [in] inputShapes The input shapes layer has. + /// @return A vector to the inferred output shape. std::vector InferOutputShapes(const std::vector& inputShapes) const override; + /// Indicates if the other layer received is equal to this one. + /// @param other The other layer to be compared with. + /// @return true if other layer is equal to this false otherwise. bool IsEqual(const Layer& other) const { return (other.GetType() == LayerType::Reshape) && @@ -27,7 +44,12 @@ public: } protected: + /// Constructor to create a ReshapeLayer. + /// @param [in] param ReshapeDescriptor to configure the reshape operation. + /// @param [in] name Optional name for the layer. ReshapeLayer(const ReshapeDescriptor& desc, const char* name); + + /// Default destructor ~ReshapeLayer() = default; }; diff --git a/src/armnn/layers/ResizeBilinearLayer.hpp b/src/armnn/layers/ResizeBilinearLayer.hpp index 2225a29935..185d8a59e1 100644 --- a/src/armnn/layers/ResizeBilinearLayer.hpp +++ b/src/armnn/layers/ResizeBilinearLayer.hpp @@ -9,19 +9,38 @@ namespace armnn { +/// This layer represents a resize bilinear operation. class ResizeBilinearLayer : public LayerWithParameters { public: - virtual std::unique_ptr - CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Makes a workload for the ResizeBilinear type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. + virtual std::unique_ptrCreateWorkload(const Graph& graph, + const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. ResizeBilinearLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref ResizeBilinearLayer. void ValidateTensorShapesFromInputs() override; + + /// By default returns inputShapes if the number of inputs are equal to number of outputs, + /// otherwise infers the output shapes from given input shapes and layer properties. + /// @param [in] inputShapes The input shapes layer has. + /// @return A vector to the inferred output shape. std::vector InferOutputShapes(const std::vector& inputShapes) const override; protected: + /// Constructor to create a ResizeBilinearLayerLayer. + /// @param [in] param ResizeBilinearDescriptor to configure the resize bilinear operation. + /// @param [in] name Optional name for the layer. ResizeBilinearLayer(const ResizeBilinearDescriptor& param, const char* name); + + /// Default destructor ~ResizeBilinearLayer() = default; }; diff --git a/src/armnn/layers/SoftmaxLayer.hpp b/src/armnn/layers/SoftmaxLayer.hpp index ae15c362db..f6bc8941d9 100644 --- a/src/armnn/layers/SoftmaxLayer.hpp +++ b/src/armnn/layers/SoftmaxLayer.hpp @@ -9,18 +9,32 @@ namespace armnn { +/// This layer represents a softmax operation. class SoftmaxLayer : public LayerWithParameters { public: + /// Makes a workload for the Softmax type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. SoftmaxLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref SoftmaxLayer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create a SoftmaxLayer. + /// @param [in] param SoftmaxDescriptor to configure the softmax operation. + /// @param [in] name Optional name for the layer. SoftmaxLayer(const SoftmaxDescriptor& param, const char* name); + + /// Default destructor ~SoftmaxLayer() = default; }; diff --git a/src/armnn/layers/SpaceToBatchNdLayer.hpp b/src/armnn/layers/SpaceToBatchNdLayer.hpp index 090fb35989..3e91bbd88c 100644 --- a/src/armnn/layers/SpaceToBatchNdLayer.hpp +++ b/src/armnn/layers/SpaceToBatchNdLayer.hpp @@ -10,20 +10,38 @@ namespace armnn { +/// This layer represents a SpaceToBatchNd operation. class SpaceToBatchNdLayer : public LayerWithParameters { public: + /// Makes a workload for the SpaceToBatchNd type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. SpaceToBatchNdLayer* Clone(Graph& graph) const override; + /// By default returns inputShapes if the number of inputs are equal to number of outputs, + /// otherwise infers the output shapes from given input shapes and layer properties. + /// @param [in] inputShapes The input shapes layer has. + /// @return A vector to the inferred output shape. std::vector InferOutputShapes(const std::vector& inputShapes) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref SpaceToBatchNdLayer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create a SpaceToBatchNdLayer. + /// @param [in] param SpaceToBatchNdDescriptor to configure the SpaceToBatchNdLayer operation. + /// @param [in] name Optional name for the layer. SpaceToBatchNdLayer(const SpaceToBatchNdDescriptor param, const char* name); + + /// Default destructor ~SpaceToBatchNdLayer() = default; }; diff --git a/src/armnn/layers/SplitterLayer.hpp b/src/armnn/layers/SplitterLayer.hpp index 411efde8f0..6a73510f33 100644 --- a/src/armnn/layers/SplitterLayer.hpp +++ b/src/armnn/layers/SplitterLayer.hpp @@ -9,20 +9,44 @@ namespace armnn { +/// This layer represents a split operation. class SplitterLayer : public LayerWithParameters { public: + /// Makes a workload for the Splitter type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + + /// Set the outputs to be appropriate sub tensors of the input if sub tensors are supported + /// otherwise creates tensor handlers. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. virtual void CreateTensorHandles(Graph& graph, const IWorkloadFactory& factory) override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. SplitterLayer* Clone(Graph& graph) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref SplitterLayer. void ValidateTensorShapesFromInputs() override; + + /// By default returns inputShapes if the number of inputs are equal to number of outputs, + /// otherwise infers the output shapes from given input shapes and layer properties. + /// @param [in] inputShapes The input shapes layer has. + /// @return A vector to the inferred output shape. std::vector InferOutputShapes(const std::vector& inputShapes) const override; protected: + /// Constructor to create a SplitterLayer. + /// @param [in] param ViewsDescriptor to configure the splitter operation. + /// @param [in] name Optional name for the layer. SplitterLayer(const ViewsDescriptor& param, const char* name); + + /// Default destructor ~SplitterLayer() = default; }; diff --git a/src/armnn/layers/StridedSliceLayer.hpp b/src/armnn/layers/StridedSliceLayer.hpp index c3aad53e19..761dc5e600 100644 --- a/src/armnn/layers/StridedSliceLayer.hpp +++ b/src/armnn/layers/StridedSliceLayer.hpp @@ -9,20 +9,38 @@ namespace armnn { +/// This layer represents a strided slice operation. class StridedSliceLayer : public LayerWithParameters { public: + /// Makes a workload for the StridedSlice type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. StridedSliceLayer* Clone(Graph& graph) const override; + /// By default returns inputShapes if the number of inputs are equal to number of outputs, + /// otherwise infers the output shapes from given input shapes and layer properties. + /// @param [in] inputShapes The input shapes layer has. + /// @return A vector to the inferred output shape. std::vector InferOutputShapes(const std::vector& inputShapes) const override; + /// Check if the input tensor shape(s) + /// will lead to a valid configuration of @ref StridedSliceLayer. void ValidateTensorShapesFromInputs() override; protected: + /// Constructor to create a StridedSliceLayer. + /// @param [in] param StridedSliceDescriptor to configure the strided slice layer. + /// @param [in] name Optional name for the layer. StridedSliceLayer(const StridedSliceDescriptor& param, const char* name); + + /// Default destructor ~StridedSliceLayer() = default; }; diff --git a/src/armnn/layers/SubtractionLayer.hpp b/src/armnn/layers/SubtractionLayer.hpp index d1bccfe81e..15d5684cdc 100644 --- a/src/armnn/layers/SubtractionLayer.hpp +++ b/src/armnn/layers/SubtractionLayer.hpp @@ -10,16 +10,27 @@ namespace armnn { +/// This layer represents a subtraction operation. class SubtractionLayer : public ElementwiseBaseLayer { public: + /// Makes a workload for the Subtraction type. + /// @param [in] graph The graph where this layer can be found. + /// @param [in] factory The workload factory which will create the workload. + /// @return A pointer to the created workload, or nullptr if not created. virtual std::unique_ptr CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const override; + /// Creates a dynamically-allocated copy of this layer. + /// @param [in] graph The graph into which this layer is being cloned. SubtractionLayer* Clone(Graph& graph) const override; protected: + /// Constructor to create a SubtractionLayer. + /// @param [in] name Optional name for the layer. SubtractionLayer(const char* name); + + /// Default destructor ~SubtractionLayer() = default; }; -- cgit v1.2.1