diff options
Diffstat (limited to 'arm_compute/runtime')
-rw-r--r-- | arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h | 54 |
1 files changed, 7 insertions, 47 deletions
diff --git a/arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h b/arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h index 58b11744a8..bc45e58b4b 100644 --- a/arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h +++ b/arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h @@ -31,55 +31,15 @@ #include "arm_compute/runtime/NEON/functions/NEFlattenLayer.h" #include "arm_compute/runtime/NEON/functions/NEGEMM.h" #include "arm_compute/runtime/NEON/functions/NEGEMMLowpMatrixMultiplyCore.h" +#include "arm_compute/runtime/NEON/functions/NETranspose.h" #include "arm_compute/runtime/Tensor.h" namespace arm_compute { -/** Basic function to reshape the weights of Fully Connected layer. This function calls the following kernels: - * - * @note The fully connected layer accepts "weights" tensors only with 2 dimensions. - */ -class NEFullyConnectedLayerReshapeWeights : public IFunction -{ -public: - /** Constructor */ - 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) */ - NEFullyConnectedLayerReshapeWeights &operator=(const NEFullyConnectedLayerReshapeWeights &) = delete; - /** Prevent instances of this class from being moved (As this class contains non movable objects) */ - NEFullyConnectedLayerReshapeWeights(NEFullyConnectedLayerReshapeWeights &&) = delete; - /** Prevent instances of this class from being moved (As this class contains non movable objects) */ - NEFullyConnectedLayerReshapeWeights &operator=(NEFullyConnectedLayerReshapeWeights &&) = delete; - /** Default destructor */ - ~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. - * @param[out] output Destination tensor. Data type supported: Same as @p input. - */ - void configure(const ITensor *input, ITensor *output); - /** Static function to check if given info will lead to a valid configuration of @ref NEFullyConnectedLayerReshapeWeights - * - * @param[in] input Weights tensor info. The weights must be 2 dimensional. Data types supported: QASYMM8/QASYMM8_SIGNED/F16/F32. - * @param[in] output Destination tensor info. Data type supported: Same as @p input. - * - * @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> _impl; -}; namespace weights_transformations { -/** Basic function to manage the reshape weights generated from @ref NEFullyConnectedLayerReshapeWeights */ +/** Basic function to manage the reshape weights generated from @ref NETranspose */ class NEFullyConnectedLayerReshapeWeightsManaged : public ITransformWeights { public: @@ -111,15 +71,15 @@ public: } private: - static constexpr uint32_t _uid = 0x0; - Tensor _output{}; - NEFullyConnectedLayerReshapeWeights _func{}; + static constexpr uint32_t _uid = 0x0; + Tensor _output{}; + NETranspose _func{}; }; } // namespace weights_transformations /** Basic function to compute a Fully Connected layer. This function calls the following kernels: * -# @ref NEIm2ColKernel (called when the input comes from a convolutional layer) - * -# @ref NEFullyConnectedLayerReshapeWeights (if @p are_weights_reshaped is set to false and transpose_weights is set to true ) (called once) + * -# @ref NETranspose (if @p are_weights_reshaped is set to false and transpose_weights is set to true ) (called once) * -# @ref NEGEMMMatrixMultiplyKernel or @ref NEGEMMLowpMatrixMultiplyCore (if quantized asymmetric) * -# @ref NEGEMMMatrixAdditionKernel or @ref NEGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPoint (if quantized asymmetric) (if @p biases is not equal to nullptr) * @@ -189,7 +149,7 @@ private: NEFlattenLayer _flatten; NEConvertFullyConnectedWeights _convert_weights; weights_transformations::NEConvertFullyConnectedWeightsManaged _convert_weights_managed; - NEFullyConnectedLayerReshapeWeights _reshape_weights_function; + NETranspose _reshape_weights_function; weights_transformations::NEFullyConnectedLayerReshapeWeightsManaged _reshape_weights_managed_function; NEGEMM _mm_gemm; NEGEMMLowpMatrixMultiplyCore _mm_gemmlowp; |