From d1dc09c95602ec1506bb4934aed1792752b5ffcf Mon Sep 17 00:00:00 2001 From: Teresa Charlin Date: Thu, 4 Mar 2021 15:24:45 +0000 Subject: Port CpuTranspose to new API Partially Resolves: COMPMID-4277 (2/2) Signed-off-by: Teresa Charlin Change-Id: Id8ee520081fe905cb796d4376864fa84ac384caa Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/c/VisualCompute/ComputeLibrary/+/303714 Tested-by: bsgcomp Reviewed-by: Sang-Hoon Park Reviewed-by: Georgios Pinitas Comments-Addressed: bsgcomp Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5217 Tested-by: Arm Jenkins Reviewed-by: Manuel Bottini Comments-Addressed: Arm Jenkins --- .../runtime/NEON/functions/NEFullyConnectedLayer.h | 14 ++++++--- arm_compute/runtime/NEON/functions/NEPermute.h | 4 +-- arm_compute/runtime/NEON/functions/NETranspose.h | 36 ++++++++++++++++------ 3 files changed, 39 insertions(+), 15 deletions(-) (limited to 'arm_compute/runtime/NEON') diff --git a/arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h b/arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h index ffea02670f..1b3f36d866 100644 --- a/arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h +++ b/arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h @@ -25,7 +25,6 @@ #define ARM_COMPUTE_NEFULLYCONNECTEDLAYER_H #include "arm_compute/runtime/IFunction.h" -#include "arm_compute/runtime/NEON/INESimpleFunctionNoBorder.h" #include "arm_compute/runtime/MemoryGroup.h" #include "arm_compute/runtime/NEON/functions/NEConvertFullyConnectedWeights.h" @@ -40,11 +39,11 @@ namespace arm_compute * * @note The fully connected layer accepts "weights" tensors only with 2 dimensions. */ -class NEFullyConnectedLayerReshapeWeights : public INESimpleFunctionNoBorder +class NEFullyConnectedLayerReshapeWeights : public IFunction { public: /** Constructor */ - NEFullyConnectedLayerReshapeWeights() = default; + NEFullyConnectedLayerReshapeWeights(); /** Prevent instances of this class from being copied (As this class contains pointers) */ NEFullyConnectedLayerReshapeWeights(const NEFullyConnectedLayerReshapeWeights &) = delete; /** Prevent instances of this class from being copied (As this class contains pointers) */ @@ -54,7 +53,7 @@ public: /** Prevent instances of this class from being moved (As this class contains non movable objects) */ NEFullyConnectedLayerReshapeWeights &operator=(NEFullyConnectedLayerReshapeWeights &&) = delete; /** Default destructor */ - ~NEFullyConnectedLayerReshapeWeights() = default; + ~NEFullyConnectedLayerReshapeWeights(); /** Set the input and output tensors. * * @param[in] input Weights tensor. The weights must be 2 dimensional. Data types supported: QASYMM8/QASYMM8_SIGNED/F16/F32. @@ -69,6 +68,13 @@ public: * @return a status */ static Status validate(const ITensorInfo *input, const ITensorInfo *output); + + // Inherited methods overridden + void run() override; + +private: + struct Impl; + std::unique_ptr _impl; }; namespace weights_transformations diff --git a/arm_compute/runtime/NEON/functions/NEPermute.h b/arm_compute/runtime/NEON/functions/NEPermute.h index cf7e25213b..fb95e45bdb 100644 --- a/arm_compute/runtime/NEON/functions/NEPermute.h +++ b/arm_compute/runtime/NEON/functions/NEPermute.h @@ -47,11 +47,11 @@ public: /** Prevent instances of this class from being copied (As this class contains pointers) */ NEPermute(const NEPermute &) = delete; /** Default move constructor */ - NEPermute(NEPermute &&); + NEPermute(NEPermute &&) = default; /** Prevent instances of this class from being copied (As this class contains pointers) */ NEPermute &operator=(const NEPermute &) = delete; /** Default move assignment operator */ - NEPermute &operator=(NEPermute &&); + NEPermute &operator=(NEPermute &&) = default; /** Configure the permute Neon kernel * * @note Arbitrary permutation vectors are supported with rank not greater than 4 diff --git a/arm_compute/runtime/NEON/functions/NETranspose.h b/arm_compute/runtime/NEON/functions/NETranspose.h index fac1d406fb..78916f67b7 100644 --- a/arm_compute/runtime/NEON/functions/NETranspose.h +++ b/arm_compute/runtime/NEON/functions/NETranspose.h @@ -24,22 +24,34 @@ #ifndef ARM_COMPUTE_NETRANSPOSE_H #define ARM_COMPUTE_NETRANSPOSE_H +#include "arm_compute/runtime/IFunction.h" + #include "arm_compute/core/Types.h" -#include "arm_compute/runtime/NEON/INESimpleFunctionNoBorder.h" + +#include namespace arm_compute { +// Forward declarations class ITensor; class ITensorInfo; -/** Basic function to transpose a matrix on Neon. This function calls the following Neon kernel: - * - * -# @ref NETransposeKernel - * - */ -class NETranspose : public INESimpleFunctionNoBorder +/** Basic function to run @ref cpu::kernels::CpuTransposeKernel */ +class NETranspose : public IFunction { public: + /** Default Constructor */ + NETranspose(); + /** Default Destructor */ + ~NETranspose(); + /** Prevent instances of this class from being copied (As this class contains pointers) */ + NETranspose(const NETranspose &) = delete; + /** Default move constructor */ + NETranspose(NETranspose &&) = default; + /** Prevent instances of this class from being copied (As this class contains pointers) */ + NETranspose &operator=(const NETranspose &) = delete; + /** Default move assignment operator */ + NETranspose &operator=(NETranspose &&) = default; /** Initialise the kernel's inputs and output * * @param[in] input Input tensor. Data types supported: All @@ -54,7 +66,13 @@ public: * @return a status */ static Status validate(const ITensorInfo *input, const ITensorInfo *output); + + // Inherited methods overridden + void run() override; + +private: + struct Impl; + std::unique_ptr _impl; }; } // namespace arm_compute - -#endif /* ARM_COMPUTE_NETRANSPOSE_H */ +#endif /* ARM_COMPUTE_NETRANSPOSE_H */ \ No newline at end of file -- cgit v1.2.1