aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
authorManuel Bottini <manuel.bottini@arm.com>2020-08-26 16:28:38 +0100
committerManuel Bottini <manuel.bottini@arm.com>2020-10-02 13:55:52 +0000
commitfc2f6d0427e1d886fcccc68867d1af1ccd96608b (patch)
tree7b8d65c9354f65fa92a6c15106ffc55f3c79403c /arm_compute
parent9aa05a67b58b65603fd52d76690a17a155e89030 (diff)
downloadComputeLibrary-fc2f6d0427e1d886fcccc68867d1af1ccd96608b.tar.gz
COMPMID-3145: Remove padding from NEScaleKernel
Change-Id: I530b12c6270d7dbeb3ef7af62484842ebcb65925 Signed-off-by: Manuel Bottini <manuel.bottini@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4000 Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r--arm_compute/core/NEON/kernels/NEScaleKernel.h34
-rw-r--r--arm_compute/runtime/NEON/functions/NEScale.h49
2 files changed, 27 insertions, 56 deletions
diff --git a/arm_compute/core/NEON/kernels/NEScaleKernel.h b/arm_compute/core/NEON/kernels/NEScaleKernel.h
index a2328b13bc..b35bb72741 100644
--- a/arm_compute/core/NEON/kernels/NEScaleKernel.h
+++ b/arm_compute/core/NEON/kernels/NEScaleKernel.h
@@ -83,34 +83,44 @@ public:
// Inherited methods overridden:
void run(const Window &window, const ThreadInfo &info) override;
- BorderSize border_size() const override;
private:
- /** function to perform scale using nearest interpolation on the given window */
- void scale_nearest_nchw(const Window &window);
- /** function to perform scale using bilinear interpolation on the given window */
- void scale_bilinear_nchw(const Window &window);
/** function to perform scale using area interpolation on the given window
*
* @note Used only in case down-sampling.
*/
- void scale_area_nchw(const Window &window);
- /** function to perform scale on the given window */
- void scale_nhwc(const Window &window);
- /** Scale function to use for the particular interpolation type passed to configure() */
- void (NEScaleKernel::*_func)(const Window &window);
+ void scale_area_nchw_u8(const Window &window);
+
+ /** function to perform scale using bilinear interpolation on the given window */
+ template <typename T>
+ void scale_bilinear_nchw(const Window &window);
+ /** function to perform scale using bilinear interpolation on the given window */
+ template <typename T>
+ void scale_bilinear_nhwc(const Window &window);
+ /** function to perform scale using bilinear interpolation on the given window */
+ template <typename T>
+ void scale_bilinear_qasymm(const Window &window);
+
+ /** function to perform scale using nearest neighbour on the given window */
+ template <typename T>
+ void scale_nearest_nchw(const Window &window);
+ /** function to perform scale using nearest neighbour on the given window */
+ template <typename T>
+ void scale_nearest_nhwc(const Window &window);
+
+ /** Scale function to use for the particular function to use */
+ using ScaleFunctionPtr = void (NEScaleKernel::*)(const Window &window);
+ ScaleFunctionPtr _func;
const ITensor *_offsets;
const ITensor *_dx;
const ITensor *_dy;
const ITensor *_input;
ITensor *_output;
InterpolationPolicy _policy;
- BorderSize _border_size;
BorderMode _border_mode;
PixelValue _constant_border_value;
float _sampling_offset;
- bool _use_padding;
bool _align_corners;
};
} // namespace arm_compute
diff --git a/arm_compute/runtime/NEON/functions/NEScale.h b/arm_compute/runtime/NEON/functions/NEScale.h
index f149e3bbb9..4063e558a6 100644
--- a/arm_compute/runtime/NEON/functions/NEScale.h
+++ b/arm_compute/runtime/NEON/functions/NEScale.h
@@ -24,20 +24,17 @@
#ifndef ARM_COMPUTE_NESCALEIMAGE_H
#define ARM_COMPUTE_NESCALEIMAGE_H
-#include "arm_compute/core/NEON/kernels/NEFillBorderKernel.h"
#include "arm_compute/core/NEON/kernels/NEScaleKernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/IFunction.h"
+#include "arm_compute/runtime/NEON/INESimpleFunctionNoBorder.h"
#include "arm_compute/runtime/Tensor.h"
-#include <cstdint>
-
namespace arm_compute
{
class ITensor;
/** Basic function to run @ref NEScaleKernel */
-class NEScale : public IFunction
+class NEScale : public INESimpleFunctionNoBorder
{
public:
/** Constructor
@@ -47,20 +44,6 @@ public:
NEScale();
/** Initialize the function's source, destination, interpolation type and border_mode.
*
- * @param[in, out] input Source tensor. Data type supported: QASYMM8/QASYMM8_SIGNED/U8/S16/F16/F32. (Written to only for @p border_mode != UNDEFINED)
- * @param[out] output Destination tensor. Data type supported: Same as @p input. All but the lowest two dimensions must be the same size as in the input tensor, i.e. scaling is only performed within the XY-plane.
- * @param[in] policy The interpolation type.
- * @param[in] border_mode Strategy to use for borders.
- * @param[in] constant_border_value (Optional) Constant value to use for borders if border_mode is set to CONSTANT.
- * @param[in] sampling_policy (Optional) Sampling policy used by the interpolation. Defaults to @ref SamplingPolicy::CENTER
- * @param[in] use_padding (Optional) Is padding in use or not. Defaults to true.
- * @param[in] align_corners (Optional) Align corners of input and output, only affecting bilinear policy with TOP_LEFT sampling policy. Defaults to false.
- */
- ARM_COMPUTE_DEPRECATED_REL(20.08)
- void configure(ITensor *input, ITensor *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value = PixelValue(),
- SamplingPolicy sampling_policy = SamplingPolicy::CENTER, bool use_padding = true, bool align_corners = false);
- /** Initialize the function's source, destination, interpolation type and border_mode.
- *
* @param[in, out] input Source tensor. Data type supported: QASYMM8/QASYMM8_SIGNED/U8/S16/F16/F32. (Written to only for @p border_mode != UNDEFINED)
* @param[out] output Destination tensor. Data type supported: Same as @p input. All but the lowest two dimensions must be the same size as in the input tensor, i.e. scaling is only performed within the XY-plane.
* @param[in] info @ref ScaleKernelInfo to be used for configuration
@@ -68,22 +51,6 @@ public:
void configure(ITensor *input, ITensor *output, const ScaleKernelInfo &info);
/** Static function to check if given info will lead to a valid configuration of @ref NEScale
*
- * @param[in] input Source tensor. Data type supported: QASYMM8/QASYMM8_SIGNED/U8/S16/F16/F32. (Written to only for @p border_mode != UNDEFINED)
- * @param[in] output Destination tensor. Data type supported: Same as @p input. All but the lowest two dimensions must be the same size as in the input tensor, i.e. scaling is only performed within the XY-plane.
- * @param[in] policy The interpolation type.
- * @param[in] border_mode Strategy to use for borders.
- * @param[in] constant_border_value (Optional) Constant value to use for borders if border_mode is set to CONSTANT.
- * @param[in] sampling_policy (Optional) Sampling policy used by the interpolation. Defaults to @ref SamplingPolicy::CENTER
- * @param[in] use_padding (Optional) Is padding in use or not. Defaults to true.
- * @param[in] align_corners (Optional) Align corners of input and output, only affecting bilinear policy with TOP_LEFT sampling policy. Defaults to false.
- *
- * @return a status
- */
- ARM_COMPUTE_DEPRECATED_REL(20.08)
- static Status validate(const ITensorInfo *input, const ITensorInfo *output, InterpolationPolicy policy, BorderMode border_mode,
- PixelValue constant_border_value = PixelValue(), SamplingPolicy sampling_policy = SamplingPolicy::CENTER, bool use_padding = true, bool align_corners = false);
- /** Static function to check if given info will lead to a valid configuration of @ref NEScale
- *
* @param[in] input Source tensor. Data type supported: QASYMM8/QASYMM8_SIGNED/U8/S16/F16/F32. (Written to only for @p border_mode != UNDEFINED)
* @param[in] output Destination tensor. Data type supported: Same as @p input. All but the lowest two dimensions must be the same size as in the input tensor, i.e. scaling is only performed within the XY-plane.
* @param[in] info @ref ScaleKernelInfo to be used for validation
@@ -92,16 +59,10 @@ public:
*/
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const ScaleKernelInfo &info);
- // Inherited methods overridden:
- void run() override;
-
private:
- Tensor _offsets; /**< Offset to access the element with NEAREST interpolation or the top-left element with BILINEAR interpolation in the input tensor */
- Tensor _dx; /**< Element's distance between the X real coordinate and the smallest X following integer */
- Tensor _dy; /**< Element's distance between the Y real coordinate and the smallest Y following integer */
- NEScaleKernel _scale_kernel; /**< Kernel to perform the scaling */
- NEFillBorderKernel _border_handler; /**< kernel to handle tensor borders */
- bool _use_padding; /**< Is padding used on the tensors */
+ Tensor _offsets; /**< Offset to access the element with NEAREST interpolation or the top-left element with BILINEAR interpolation in the input tensor */
+ Tensor _dx; /**< Element's distance between the X real coordinate and the smallest X following integer */
+ Tensor _dy; /**< Element's distance between the Y real coordinate and the smallest Y following integer */
};
} // namespace arm_compute
#endif /*ARM_COMPUTE_NESCALEIMAGE_H */