diff options
author | Derek Lamberti <derek.lamberti@arm.com> | 2019-03-25 16:28:44 +0000 |
---|---|---|
committer | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-03-28 11:11:29 +0000 |
commit | 61f54634701d070dbf48e082993fa58104d6f329 (patch) | |
tree | 41281cd398aad80218bf7ece25e9a7d3e6783e77 /include/armnn/ILayerVisitor.hpp | |
parent | 8b6df4da2b5528e9ace75e86e7fe2cc684b6a89a (diff) | |
download | armnn-61f54634701d070dbf48e082993fa58104d6f329.tar.gz |
IVGCVSW-2880 Refactor order of methods
Change-Id: I1c08ea47c19477e739d7b0f35e6f97928d53d469
Signed-off-by: Derek Lamberti <derek.lamberti@arm.com>
Diffstat (limited to 'include/armnn/ILayerVisitor.hpp')
-rw-r--r-- | include/armnn/ILayerVisitor.hpp | 325 |
1 files changed, 164 insertions, 161 deletions
diff --git a/include/armnn/ILayerVisitor.hpp b/include/armnn/ILayerVisitor.hpp index 76027f6eed..a39cbd10b9 100644 --- a/include/armnn/ILayerVisitor.hpp +++ b/include/armnn/ILayerVisitor.hpp @@ -19,14 +19,55 @@ protected: virtual ~ILayerVisitor() {} public: - /// Function that an InputLayer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// Function that an activation layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param id - User generated id to uniquely identify a particular input. The same id needs to be specified - /// when passing the inputs to the IRuntime::EnqueueWorkload() function. + /// @param activationDescriptor - ActivationDescriptor to configure the activation. /// @param name - Optional name for the layer. - virtual void VisitInputLayer(const IConnectableLayer* layer, - LayerBindingId id, - const char* name = nullptr) = 0; + virtual void VisitActivationLayer(const IConnectableLayer* layer, + const ActivationDescriptor& activationDescriptor, + const char* name = nullptr) = 0; + + /// Function that an addition layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// @param layer - pointer to the layer which is calling back to this visit function. + /// @param name - Optional name for the layer. + virtual void VisitAdditionLayer(const IConnectableLayer* layer, + const char* name = nullptr) = 0; + + /// Function that a batch normalization layer should call back to when its Accept(ILayerVisitor&) + /// function is invoked. + /// @param layer - pointer to the layer which is calling back to this visit function. + /// @param mean - Pre-calculated mean for each channel. + /// @param variance - Pre-calculated variance for each channel. + /// @param beta - Per-channel additive factor. + /// @param gamma - Per-channel multiplicative factor. + /// @param name - Optional name for the layer. + virtual void VisitBatchNormalizationLayer(const IConnectableLayer* layer, + const BatchNormalizationDescriptor& desc, + const ConstTensor& mean, + const ConstTensor& variance, + const ConstTensor& beta, + const ConstTensor& gamma, + const char* name = nullptr) = 0; + + /// Function that a batch to space ND layer should call back to when its Accept(ILayerVisitor&) + /// function is invoked. + /// @param layer - pointer to the layer which is calling back to this visit function. + /// @param batchToSpaceNdDescriptor - Description of the layer. + /// @param name - Optional name for the layer. + virtual void VisitBatchToSpaceNdLayer(const IConnectableLayer* layer, + const BatchToSpaceNdDescriptor& batchToSpaceNdDescriptor, + const char* name = nullptr) = 0; + + /// Function a layer with no inputs and a single output, which always corresponds to + /// the passed in constant tensor should call back to when its Accept(ILayerVisitor&) function is invoked. + /// @param layer - pointer to the layer which is calling back to this visit function. + /// @param input - Tensor to be provided as the only output of the layer. The layer will maintain + /// its own copy of the tensor data, meaning the memory referenced by @a input can + /// be freed or reused after this function is called. + /// @param name - Optional name for the layer. + virtual void VisitConstantLayer(const IConnectableLayer* layer, + const ConstTensor& input, + const char* name = nullptr) = 0; /// Function that a 2D convolution layer should call back to when its Accept(ILayerVisitor&) /// function is invoked. @@ -65,6 +106,24 @@ public: const ConstTensor& anchors, const char* name = nullptr) = 0; + /// Function a division layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// @param layer - pointer to the layer which is calling back to this visit function. + /// @param name - Optional name for the layer. + virtual void VisitDivisionLayer(const IConnectableLayer* layer, + const char* name = nullptr) = 0; + + /// Function an Equal layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// @param layer - pointer to the layer which is calling back to this visit function. + /// @param name - Optional name for the layer. + virtual void VisitEqualLayer(const IConnectableLayer* layer, + const char* name = nullptr) = 0; + + /// Function a floor layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// @param layer - pointer to the layer which is calling back to this visit function. + /// @param name - Optional name for the layer. + virtual void VisitFloorLayer(const IConnectableLayer* layer, + const char* name = nullptr) = 0; + /// Function that a fully connected layer should call back to when its Accept(ILayerVisitor&) /// function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. @@ -78,65 +137,60 @@ public: const Optional<ConstTensor>& biases, const char* name = nullptr) = 0; - /// Function that a permute layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param permuteDescriptor - PermuteDescriptor to configure the permute. /// @param name - Optional name for the layer. - virtual void VisitPermuteLayer(const IConnectableLayer* layer, - const PermuteDescriptor& permuteDescriptor, - const char* name = nullptr) = 0; + virtual void VisitGatherLayer(const IConnectableLayer* layer, + const char* name = nullptr) = 0; - /// Function that a batch to space ND layer should call back to when its Accept(ILayerVisitor&) - /// function is invoked. + /// Function a Greater layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param batchToSpaceNdDescriptor - Description of the layer. /// @param name - Optional name for the layer. - virtual void VisitBatchToSpaceNdLayer(const IConnectableLayer* layer, - const BatchToSpaceNdDescriptor& batchToSpaceNdDescriptor, - const char* name = nullptr) = 0; + virtual void VisitGreaterLayer(const IConnectableLayer* layer, + const char* name = nullptr) = 0; - /// Function that a pooling layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// Function that an InputLayer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param pooling2dDescriptor - Pooling2dDescriptor to configure the pooling. + /// @param id - User generated id to uniquely identify a particular input. The same id needs to be specified + /// when passing the inputs to the IRuntime::EnqueueWorkload() function. /// @param name - Optional name for the layer. - virtual void VisitPooling2dLayer(const IConnectableLayer* layer, - const Pooling2dDescriptor& pooling2dDescriptor, - const char* name = nullptr) = 0; + virtual void VisitInputLayer(const IConnectableLayer* layer, + LayerBindingId id, + const char* name = nullptr) = 0; - /// Function that an activation layer should call back to when its Accept(ILayerVisitor&) function is invoked. + + /// Function that an L2 normalization layer should call back to when its Accept(ILayerVisitor&) + /// function is invoked. Normalization is performed along dimension 1, but requires a 4d input. /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param activationDescriptor - ActivationDescriptor to configure the activation. + /// @param desc - Parameters for the L2 normalization operation. /// @param name - Optional name for the layer. - virtual void VisitActivationLayer(const IConnectableLayer* layer, - const ActivationDescriptor& activationDescriptor, - const char* name = nullptr) = 0; + virtual void VisitL2NormalizationLayer(const IConnectableLayer* layer, + const L2NormalizationDescriptor& desc, + const char* name = nullptr) = 0; - /// Function that a normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// Function an Lstm layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param normalizationDescriptor - NormalizationDescriptor to configure the normalization. + /// @param descriptor - Parameters controlling the operation of the Lstm operation. + /// @param params - The weights and biases for the LSTM cell. /// @param name - Optional name for the layer. - virtual void VisitNormalizationLayer(const IConnectableLayer* layer, - const NormalizationDescriptor& normalizationDescriptor, - const char* name = nullptr) = 0; + virtual void VisitLstmLayer(const IConnectableLayer* layer, + const LstmDescriptor& descriptor, + const LstmInputParams& params, + const char* name = nullptr) = 0; - /// Function that a softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// Function a Maximum layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param softmaxDescriptor - SoftmaxDescriptor to configure the softmax. /// @param name - Optional name for the layer. - virtual void VisitSoftmaxLayer(const IConnectableLayer* layer, - const SoftmaxDescriptor& softmaxDescriptor, + virtual void VisitMaximumLayer(const IConnectableLayer* layer, const char* name = nullptr) = 0; - /// Function that a splitter layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// Function a Mean layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param splitterDescriptor - WindowsDescriptor to configure the splitting process. - /// Number of Views must be equal to the number of outputs, - /// and their order must match - e.g. first view corresponds to - /// the first output, second view to the second output, etc.... + /// @param meanDescriptor - Parameters for the mean operation. /// @param name - Optional name for the layer. - virtual void VisitSplitterLayer(const IConnectableLayer* layer, - const ViewsDescriptor& splitterDescriptor, - const char* name = nullptr) = 0; + virtual void VisitMeanLayer(const IConnectableLayer* layer, + const MeanDescriptor& meanDescriptor, + const char* name = nullptr) = 0; /// Function that a merger layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. @@ -148,11 +202,11 @@ public: const OriginsDescriptor& mergerDescriptor, const char* name = nullptr) = 0; - /// Function that an addition layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// Function a Minimum layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. /// @param name - Optional name for the layer. - virtual void VisitAdditionLayer(const IConnectableLayer* layer, - const char* name = nullptr) = 0; + virtual void VisitMinimumLayer(const IConnectableLayer* layer, + const char* name = nullptr) = 0; /// Function that a multiplication layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. @@ -160,48 +214,53 @@ public: virtual void VisitMultiplicationLayer(const IConnectableLayer* layer, const char* name = nullptr) = 0; - /// Function that a batch normalization layer should call back to when its Accept(ILayerVisitor&) - /// function is invoked. + /// Function that a normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param mean - Pre-calculated mean for each channel. - /// @param variance - Pre-calculated variance for each channel. - /// @param beta - Per-channel additive factor. - /// @param gamma - Per-channel multiplicative factor. + /// @param normalizationDescriptor - NormalizationDescriptor to configure the normalization. /// @param name - Optional name for the layer. - virtual void VisitBatchNormalizationLayer(const IConnectableLayer* layer, - const BatchNormalizationDescriptor& desc, - const ConstTensor& mean, - const ConstTensor& variance, - const ConstTensor& beta, - const ConstTensor& gamma, - const char* name = nullptr) = 0; + virtual void VisitNormalizationLayer(const IConnectableLayer* layer, + const NormalizationDescriptor& normalizationDescriptor, + const char* name = nullptr) = 0; - /// Function that a resize bilinear layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// Function an output layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param resizeDesc - Parameters for the resize operation. + /// @param id - User generated id to uniquely identify a particular output. The same id needs to be specified + /// when passing the outputs to the IRuntime::EnqueueWorkload() function. /// @param name - Optional name for the layer. - virtual void VisitResizeBilinearLayer(const IConnectableLayer* layer, - const ResizeBilinearDescriptor& resizeDesc, - const char* name = nullptr) = 0; + virtual void VisitOutputLayer(const IConnectableLayer* layer, + LayerBindingId id, + const char* name = nullptr) = 0; - /// Function that an L2 normalization layer should call back to when its Accept(ILayerVisitor&) - /// function is invoked. Normalization is performed along dimension 1, but requires a 4d input. + /// Function a pad layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param desc - Parameters for the L2 normalization operation. + /// @param paddings - n by 2 tensor, where n is the rank of the input tensor, + /// such that paddings[i,0] indicates the amount of padding to add in front of dimension i, and + /// paddings[i,1] indicates the amount of padding to add after the end of dimension i /// @param name - Optional name for the layer. - virtual void VisitL2NormalizationLayer(const IConnectableLayer* layer, - const L2NormalizationDescriptor& desc, - const char* name = nullptr) = 0; + virtual void VisitPadLayer(const IConnectableLayer* layer, + const PadDescriptor& padDescriptor, + const char* name = nullptr) = 0; - /// Function a layer with no inputs and a single output, which always corresponds to - /// the passed in constant tensor should call back to when its Accept(ILayerVisitor&) function is invoked. + /// Function that a permute layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param input - Tensor to be provided as the only output of the layer. The layer will maintain - /// its own copy of the tensor data, meaning the memory referenced by @a input can - /// be freed or reused after this function is called. + /// @param permuteDescriptor - PermuteDescriptor to configure the permute. /// @param name - Optional name for the layer. - virtual void VisitConstantLayer(const IConnectableLayer* layer, - const ConstTensor& input, + virtual void VisitPermuteLayer(const IConnectableLayer* layer, + const PermuteDescriptor& permuteDescriptor, + const char* name = nullptr) = 0; + + /// Function that a pooling layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// @param layer - pointer to the layer which is calling back to this visit function. + /// @param pooling2dDescriptor - Pooling2dDescriptor to configure the pooling. + /// @param name - Optional name for the layer. + virtual void VisitPooling2dLayer(const IConnectableLayer* layer, + const Pooling2dDescriptor& pooling2dDescriptor, + const char* name = nullptr) = 0; + + /// Function a quantize layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// @param layer - pointer to the layer which is calling back to this visit function. + /// @param name - Optional name for the layer. + virtual void VisitQuantizeLayer(const IConnectableLayer* layer, const char* name = nullptr) = 0; /// Function a reshape layer should call back to when its Accept(ILayerVisitor&) function is invoked. @@ -212,79 +271,47 @@ public: const ReshapeDescriptor& reshapeDescriptor, const char* name = nullptr) = 0; - /// Function a space to batch layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// Function that a resize bilinear layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param spaceToBatchNdDescriptor - Parameters for the space to batch operation. + /// @param resizeDesc - Parameters for the resize operation. /// @param name - Optional name for the layer. - virtual void VisitSpaceToBatchNdLayer(const IConnectableLayer* layer, - const SpaceToBatchNdDescriptor& spaceToBatchNdDescriptor, + virtual void VisitResizeBilinearLayer(const IConnectableLayer* layer, + const ResizeBilinearDescriptor& resizeDesc, const char* name = nullptr) = 0; - /// Function a floor layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// Function a Reciprocal of square root layer should call back to when its Accept(ILayerVisitor&) + /// function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. /// @param name - Optional name for the layer. - virtual void VisitFloorLayer(const IConnectableLayer* layer, + virtual void VisitRsqrtLayer(const IConnectableLayer* layer, const char* name = nullptr) = 0; - /// Function an output layer should call back to when its Accept(ILayerVisitor&) function is invoked. - /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param id - User generated id to uniquely identify a particular output. The same id needs to be specified - /// when passing the outputs to the IRuntime::EnqueueWorkload() function. - /// @param name - Optional name for the layer. - virtual void VisitOutputLayer(const IConnectableLayer* layer, - LayerBindingId id, - const char* name = nullptr) = 0; - /// Function an Lstm layer should call back to when its Accept(ILayerVisitor&) function is invoked. - /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param descriptor - Parameters controlling the operation of the Lstm operation. - /// @param params - The weights and biases for the LSTM cell. - /// @param name - Optional name for the layer. - virtual void VisitLstmLayer(const IConnectableLayer* layer, - const LstmDescriptor& descriptor, - const LstmInputParams& params, - const char* name = nullptr) = 0; - - /// Function a division layer should call back to when its Accept(ILayerVisitor&) function is invoked. - /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param name - Optional name for the layer. - virtual void VisitDivisionLayer(const IConnectableLayer* layer, - const char* name = nullptr) = 0; - - /// Function a subtraction layer should call back to when its Accept(ILayerVisitor&) function is invoked. - /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param name - Optional name for the layer. - virtual void VisitSubtractionLayer(const IConnectableLayer* layer, - const char* name = nullptr) = 0; - - /// Function a Maximum layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// Function that a softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. + /// @param softmaxDescriptor - SoftmaxDescriptor to configure the softmax. /// @param name - Optional name for the layer. - virtual void VisitMaximumLayer(const IConnectableLayer* layer, + virtual void VisitSoftmaxLayer(const IConnectableLayer* layer, + const SoftmaxDescriptor& softmaxDescriptor, const char* name = nullptr) = 0; - /// Function a Mean layer should call back to when its Accept(ILayerVisitor&) function is invoked. - /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param meanDescriptor - Parameters for the mean operation. - /// @param name - Optional name for the layer. - virtual void VisitMeanLayer(const IConnectableLayer* layer, - const MeanDescriptor& meanDescriptor, - const char* name = nullptr) = 0; - - /// Function a pad layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// Function a space to batch layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param paddings - n by 2 tensor, where n is the rank of the input tensor, - /// such that paddings[i,0] indicates the amount of padding to add in front of dimension i, and - /// paddings[i,1] indicates the amount of padding to add after the end of dimension i + /// @param spaceToBatchNdDescriptor - Parameters for the space to batch operation. /// @param name - Optional name for the layer. - virtual void VisitPadLayer(const IConnectableLayer* layer, - const PadDescriptor& padDescriptor, - const char* name = nullptr) = 0; + virtual void VisitSpaceToBatchNdLayer(const IConnectableLayer* layer, + const SpaceToBatchNdDescriptor& spaceToBatchNdDescriptor, + const char* name = nullptr) = 0; - /// Function a quantize layer should call back to when its Accept(ILayerVisitor&) function is invoked. + /// Function that a splitter layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. + /// @param splitterDescriptor - WindowsDescriptor to configure the splitting process. + /// Number of Views must be equal to the number of outputs, + /// and their order must match - e.g. first view corresponds to + /// the first output, second view to the second output, etc.... /// @param name - Optional name for the layer. - virtual void VisitQuantizeLayer(const IConnectableLayer* layer, + virtual void VisitSplitterLayer(const IConnectableLayer* layer, + const ViewsDescriptor& splitterDescriptor, const char* name = nullptr) = 0; /// Function a strided slice layer should call back to when its Accept(ILayerVisitor&) function is invoked. @@ -295,36 +322,12 @@ public: const StridedSliceDescriptor& stridedSliceDescriptor, const char* name = nullptr) = 0; - /// Function a Minimum layer should call back to when its Accept(ILayerVisitor&) function is invoked. - /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param name - Optional name for the layer. - virtual void VisitMinimumLayer(const IConnectableLayer* layer, - const char* name = nullptr) = 0; - - /// Function a Greater layer should call back to when its Accept(ILayerVisitor&) function is invoked. - /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param name - Optional name for the layer. - virtual void VisitGreaterLayer(const IConnectableLayer* layer, - const char* name = nullptr) = 0; - - /// Function an Equal layer should call back to when its Accept(ILayerVisitor&) function is invoked. - /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param name - Optional name for the layer. - virtual void VisitEqualLayer(const IConnectableLayer* layer, - const char* name = nullptr) = 0; - - /// Function a Reciprocal of square root layer should call back to when its Accept(ILayerVisitor&) - /// function is invoked. + /// Function a subtraction layer should call back to when its Accept(ILayerVisitor&) function is invoked. /// @param layer - pointer to the layer which is calling back to this visit function. /// @param name - Optional name for the layer. - virtual void VisitRsqrtLayer(const IConnectableLayer* layer, - const char* name = nullptr) = 0; + virtual void VisitSubtractionLayer(const IConnectableLayer* layer, + const char* name = nullptr) = 0; - /// Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked. - /// @param layer - pointer to the layer which is calling back to this visit function. - /// @param name - Optional name for the layer. - virtual void VisitGatherLayer(const IConnectableLayer* layer, - const char* name = nullptr) = 0; }; -} // namespace armnn +} // namespace armnn
\ No newline at end of file |