From 1fd2c80692ed8ecefc4d8deb783564ad19eaf70c Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Tue, 16 Jun 2020 17:44:46 +0100 Subject: COMPMID-3375: Port NEActivationLayer functions/kernels to run on different tensors. Signed-off-by: Georgios Pinitas Change-Id: I98782bb73e9dc0899ffb1796aca6f99714adea94 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3343 Reviewed-by: Michalis Spyrou Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- .../core/NEON/kernels/NEActivationLayerKernel.h | 24 +++++++++++----------- .../core/NEON/kernels/NEReshapeLayerKernel.h | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'arm_compute/core/NEON') diff --git a/arm_compute/core/NEON/kernels/NEActivationLayerKernel.h b/arm_compute/core/NEON/kernels/NEActivationLayerKernel.h index 82103b988b..399afa63c6 100644 --- a/arm_compute/core/NEON/kernels/NEActivationLayerKernel.h +++ b/arm_compute/core/NEON/kernels/NEActivationLayerKernel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -33,6 +33,7 @@ namespace arm_compute { +// Forward declarations class ITensor; /** Interface for the activation layer kernel. */ @@ -57,12 +58,12 @@ public: * * @note If the output tensor is a nullptr, the activation function will be performed in-place * - * @param[in, out] input Source tensor. In case of @p output tensor = nullptr, this tensor will store the result + * @param[in, out] input Source tensor info. In case of @p output tensor = nullptr, this tensor will store the result * of the activation function. Data types supported: QASYMM8/QASYMM8_SIGNED/QSYMM16/F16/F32. - * @param[out] output Destination tensor. Data type supported: same as @p input + * @param[out] output Destination tensor info. Data type supported: same as @p input * @param[in] activation_info Activation layer information. */ - void configure(ITensor *input, ITensor *output, ActivationLayerInfo activation_info); + void configure(const ITensorInfo *input, ITensorInfo *output, ActivationLayerInfo activation_info); /** Static function to check if given info will lead to a valid configuration of @ref NEActivationLayerKernel * * @param[in] input Source tensor info. In case of @p output tensor info = nullptr, this tensor will store the result @@ -75,7 +76,8 @@ public: static Status validate(const ITensorInfo *input, const ITensorInfo *output, const ActivationLayerInfo &act_info); // Inherited methods overridden: - void run(const Window &window, const ThreadInfo &info) override; + void run_op(const std::vector &inputs, const std::vector &outputs, + const Window &window, const ThreadInfo &info) override; private: using ActivationFunction = ActivationLayerInfo::ActivationFunction; @@ -83,36 +85,34 @@ private: * * @param[in] window Region on which to execute the kernel. */ - using ActivationFunctionExecutorPtr = void (NEActivationLayerKernel::*)(const Window &window); + using ActivationFunctionExecutorPtr = void (NEActivationLayerKernel::*)(const ITensor *src, ITensor *dst, const Window &window); /** Function to apply an activation function on a tensor. * * @param[in] window Region on which to execute the kernel */ template typename std::enable_if::value, void>::type - activation(const Window &window); + activation(const ITensor *src, ITensor *dst, const Window &window); /** Function to apply an activation function on a tensor. * * @param[in] window Region on which to execute the kernel */ template - typename std::enable_if::value, void>::type activation(const Window &window); + typename std::enable_if::value, void>::type activation(const ITensor *src, ITensor *dst, const Window &window); /** Function to apply an activation function on a tensor. * * @param[in] window Region on which to execute the kernel */ template - typename std::enable_if::value, void>::type activation(const Window &window); + typename std::enable_if::value, void>::type activation(const ITensor *src, ITensor *dst, const Window &window); /** Function to apply an activation function on a tensor. * * @param[in] window Region on which to execute the kernel */ template - typename std::enable_if::value, void>::type activation(const Window &window); + typename std::enable_if::value, void>::type activation(const ITensor *src, ITensor *dst, const Window &window); private: - ITensor *_input; - ITensor *_output; ActivationFunctionExecutorPtr _func; ActivationLayerInfo _act_info; }; diff --git a/arm_compute/core/NEON/kernels/NEReshapeLayerKernel.h b/arm_compute/core/NEON/kernels/NEReshapeLayerKernel.h index 6f888e0914..7a4dce128d 100644 --- a/arm_compute/core/NEON/kernels/NEReshapeLayerKernel.h +++ b/arm_compute/core/NEON/kernels/NEReshapeLayerKernel.h @@ -57,8 +57,8 @@ public: static Status validate(const ITensorInfo *input, const ITensorInfo *output); // Inherited methods overridden: - void run_op(const std::vector &inputs, std::vector &outputs, const Window &window, const ThreadInfo &info) override; + void run_op(const std::vector &inputs, const std::vector &outputs, + const Window &window, const ThreadInfo &info) override; }; - } // namespace arm_compute #endif /*ARM_COMPUTE_NERESHAPELAYERKERNEL_H */ -- cgit v1.2.1