aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSang-Hoon Park <sang-hoon.park@arm.com>2020-06-09 12:09:24 +0100
committerSang-Hoon Park <sang-hoon.park@arm.com>2020-06-12 14:51:37 +0000
commitccd94966cc58ef5148577e71ba1a4ff5aae1f3bb (patch)
tree17efa87eff3cee7d5c2f0cfe04614b2c6d87a8fc
parente1536a82dd872651551e3ce25b2bae5da8abaf14 (diff)
downloadComputeLibrary-ccd94966cc58ef5148577e71ba1a4ff5aae1f3bb.tar.gz
COMPMID-3364: use ScaleKernelInfo for Scale on OpenCL and GLES
- Make Scale and ScaleKernel (on CL and GLES) use ScaleKernelInfo - Deprecate previous configure/validate functions on NEON, CL and GLES - Make adjustments required by deprecation Change-Id: I7e81f4ee9ae919392137b92f91e9bc002b7ae277 Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3317 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
-rw-r--r--arm_compute/core/CL/kernels/CLScaleKernel.h51
-rw-r--r--arm_compute/core/GLES_COMPUTE/kernels/GCScaleKernel.h16
-rw-r--r--arm_compute/graph/backends/FunctionHelpers.h2
-rw-r--r--arm_compute/runtime/CL/functions/CLScale.h31
-rw-r--r--arm_compute/runtime/GLES_COMPUTE/functions/GCScale.h11
-rw-r--r--arm_compute/runtime/NEON/functions/NEScale.h2
-rw-r--r--examples/cl_events.cpp4
-rw-r--r--examples/neon_scale.cpp4
-rw-r--r--examples/neoncl_scale_median_gaussian.cpp4
-rw-r--r--src/core/CL/kernels/CLScaleKernel.cpp65
-rw-r--r--src/core/GLES_COMPUTE/kernels/GCScaleKernel.cpp22
-rw-r--r--src/runtime/CL/functions/CLCropResize.cpp2
-rw-r--r--src/runtime/CL/functions/CLGaussianPyramid.cpp2
-rw-r--r--src/runtime/CL/functions/CLLaplacianReconstruct.cpp2
-rw-r--r--src/runtime/CL/functions/CLScale.cpp37
-rw-r--r--src/runtime/CL/tuners/BifrostTuner.cpp4
-rw-r--r--src/runtime/GLES_COMPUTE/functions/GCScale.cpp15
-rw-r--r--src/runtime/NEON/functions/NECropResize.cpp4
-rw-r--r--src/runtime/NEON/functions/NEGaussianPyramid.cpp2
-rw-r--r--src/runtime/NEON/functions/NELaplacianReconstruct.cpp2
-rw-r--r--src/runtime/NEON/functions/NEScale.cpp5
-rw-r--r--tests/benchmark/fixtures/ScaleFixture.h4
-rw-r--r--tests/benchmark/fixtures/ScaleLayerFixture.h4
-rw-r--r--tests/validation/CL/Scale.cpp4
-rw-r--r--tests/validation/GLES_COMPUTE/Scale.cpp2
-rw-r--r--tests/validation/NEON/Scale.cpp24
-rw-r--r--tests/validation/fixtures/ScaleFixture.h2
27 files changed, 180 insertions, 147 deletions
diff --git a/arm_compute/core/CL/kernels/CLScaleKernel.h b/arm_compute/core/CL/kernels/CLScaleKernel.h
index 328578d88c..c453a25ec7 100644
--- a/arm_compute/core/CL/kernels/CLScaleKernel.h
+++ b/arm_compute/core/CL/kernels/CLScaleKernel.h
@@ -25,7 +25,7 @@
#define ARM_COMPUTE_CLSCALEKERNEL_H
#include "arm_compute/core/CL/ICLSimple2DKernel.h"
-#include "arm_compute/core/Types.h"
+#include "arm_compute/core/KernelDescriptors.h"
namespace arm_compute
{
@@ -37,43 +37,32 @@ class CLScaleKernel : public ICLSimple2DKernel
public:
/** Initialise the kernel's inputs, output and interpolation policy
*
- * @param[in] input Source tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/F32
- * @param[out] output Destination tensor. Data types 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 Interpolation type to use
- * @param[in] border_mode Selected border mode.
- * @param[in] sampling_policy (Optional) Sampling policy used by the interpolation. Defaults to @ref SamplingPolicy::CENTER
- * @param[in] align_corners (Optional) Align corners of input and output, only affecting bilinear policy with TOP_LEFT sampling policy. Defaults to false.
+ * @param[in] input Source tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/F32
+ * @param[out] output Destination tensor. Data types 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 Kernel descriptor to be used to configure.
*/
- void configure(const ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode, SamplingPolicy sampling_policy = SamplingPolicy::CENTER, bool align_corners = false);
+ void configure(const ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info);
/** Initialise the kernel's inputs, output and interpolation policy
*
* @param[in] compile_context The compile context to be used.
* @param[in] input Source tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/F32
* @param[out] output Destination tensor. Data types 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 Interpolation type to use
- * @param[in] border_mode Selected border mode.
- * @param[in] sampling_policy (Optional) Sampling policy used by the interpolation. Defaults to @ref SamplingPolicy::CENTER
- * @param[in] align_corners (Optional) Align corners of input and output, only affecting bilinear policy with TOP_LEFT sampling policy. Defaults to false.
+ * @param[in] info @ref ScaleKernelInfo Kernel descriptor to be used to configure.
*/
- void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode,
- SamplingPolicy sampling_policy = SamplingPolicy::CENTER, bool align_corners = false);
+ void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info);
/** Static function to check if given info will lead to a valid configuration of @ref CLScaleKernel
*
- * @param[in] input Source tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/F32
- * @param[in] output Destination tensor info. Data types 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 Interpolation type to use
- * @param[in] border_mode Selected border mode.
- * @param[in] sampling_policy (Optional) Sampling policy used by the interpolation. Defaults to @ref SamplingPolicy::CENTER
- * @param[in] align_corners (Optional) Align corners of input and output, only affecting bilinear policy with TOP_LEFT sampling policy. Defaults to false.
+ * @param[in] input Source tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/F32
+ * @param[in] output Destination tensor info. Data types 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 Kernel descriptor to be used to validate
*
* @return a status
*/
- static Status validate(const ITensorInfo *input, const ITensorInfo *output, InterpolationPolicy policy, BorderMode border_mode, SamplingPolicy sampling_policy = SamplingPolicy::CENTER,
- bool align_corners = false);
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output, const ScaleKernelInfo &info);
/** Input tensor accessor.
*
* @return Pointer to input tensor.
@@ -89,10 +78,16 @@ public:
BorderSize border_size() const override;
void run(const Window &window, cl::CommandQueue &queue) override;
-public:
- InterpolationPolicy _interpolationPolicy = InterpolationPolicy::BILINEAR;
- DataLayout _data_layout = DataLayout::UNKNOWN;
- bool _align_corners = false;
+ // Getter for interpolation policy
+ InterpolationPolicy get_interpolation_policy() const
+ {
+ return _interpolation_policy;
+ }
+
+private:
+ InterpolationPolicy _interpolation_policy = InterpolationPolicy::BILINEAR;
+ DataLayout _data_layout = DataLayout::UNKNOWN;
+ bool _align_corners = false;
};
} // namespace arm_compute
#endif /*ARM_COMPUTE_CLSCALEKERNEL_H */
diff --git a/arm_compute/core/GLES_COMPUTE/kernels/GCScaleKernel.h b/arm_compute/core/GLES_COMPUTE/kernels/GCScaleKernel.h
index 754f15cbd8..d4bcdba0c4 100644
--- a/arm_compute/core/GLES_COMPUTE/kernels/GCScaleKernel.h
+++ b/arm_compute/core/GLES_COMPUTE/kernels/GCScaleKernel.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2019 ARM Limited.
+ * Copyright (c) 2016-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -25,7 +25,7 @@
#define ARM_COMPUTE_GCSCALEKERNEL_H
#include "arm_compute/core/GLES_COMPUTE/IGCSimple3DKernel.h"
-#include "arm_compute/core/Types.h"
+#include "arm_compute/core/KernelDescriptors.h"
namespace arm_compute
{
@@ -37,14 +37,12 @@ class GCScaleKernel : public IGCSimple3DKernel
public:
/** Initialise the kernel's inputs, output and interpolation policy
*
- * @param[in] input Source tensor. Data types supported: F16
- * @param[out] output Destination tensor. Data types 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 Interpolation type to use
- * @param[in] border_undefined True if the border mode is undefined. False if it's replicate or constant.
- * @param[in] sampling_policy (Optional) Sampling policy used by the interpolation. Defaults to @ref SamplingPolicy::CENTER
+ * @param[in] input Source tensor. Data types supported: F16
+ * @param[out] output Destination tensor. Data types 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 descriptor to be used to configure
*/
- void configure(const IGCTensor *input, IGCTensor *output, InterpolationPolicy policy, bool border_undefined, SamplingPolicy sampling_policy = SamplingPolicy::CENTER);
+ void configure(const IGCTensor *input, IGCTensor *output, const ScaleKernelInfo &info);
// Inherited methods overridden:
void run(const Window &window) override;
diff --git a/arm_compute/graph/backends/FunctionHelpers.h b/arm_compute/graph/backends/FunctionHelpers.h
index 382b18a888..975e5fe55e 100644
--- a/arm_compute/graph/backends/FunctionHelpers.h
+++ b/arm_compute/graph/backends/FunctionHelpers.h
@@ -1401,7 +1401,7 @@ std::unique_ptr<IFunction> create_resize_layer(ResizeLayerNode &node)
// Create and configure function
auto func = support::cpp14::make_unique<ResizeLayerFunction>();
- func->configure(input, output, policy, BorderMode::CONSTANT);
+ func->configure(input, output, ScaleKernelInfo{ policy, BorderMode::CONSTANT });
// Log info
ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated "
diff --git a/arm_compute/runtime/CL/functions/CLScale.h b/arm_compute/runtime/CL/functions/CLScale.h
index f345995138..ff091f1b77 100644
--- a/arm_compute/runtime/CL/functions/CLScale.h
+++ b/arm_compute/runtime/CL/functions/CLScale.h
@@ -24,6 +24,7 @@
#ifndef ARM_COMPUTE_CLSCALE_H
#define ARM_COMPUTE_CLSCALE_H
+#include "arm_compute/core/KernelDescriptors.h"
#include "arm_compute/core/Types.h"
#include "arm_compute/runtime/CL/ICLSimpleFunction.h"
@@ -39,6 +40,23 @@ class CLScale : public ICLSimpleFunction
public:
/** Initialize the function's source, destination, interpolation type and border_mode.
*
+ * @param[in,out] input Source tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/F32. (Written to only for @p border_mode != UNDEFINED)
+ * @param[out] output Destination tensor. Data types 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 descriptor to be used to configure
+ */
+ void configure(ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info);
+ /** Initialize the function's source, destination, interpolation type and border_mode.
+ *
+ * @param[in] compile_context The compile context to be used.
+ * @param[in,out] input Source tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/F32. (Written to only for @p border_mode != UNDEFINED)
+ * @param[out] output Destination tensor. Data types 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 descriptor to be used to configure
+ */
+ void configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info);
+ /** Initialize the function's source, destination, interpolation type and border_mode.
+ *
* @param[in,out] input Source tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/F32. (Written to only for @p border_mode != UNDEFINED)
* @param[out] output Destination tensor. Data types 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.
@@ -49,6 +67,7 @@ public:
* @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(ICLTensor *input, ICLTensor *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.
@@ -64,11 +83,22 @@ public:
* @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(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *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 CLScale
*
+ * @param[in] input Source tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/F32.
+ * @param[in] output Output tensor info. 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 descriptor to be used to validate
+ *
+ * @return a status
+ */
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output, const ScaleKernelInfo &info);
+ /** Static function to check if given info will lead to a valid configuration of @ref CLScale
+ *
* @param[in] input Source tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/F32.
* @param[in] output Output tensor info. 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.
@@ -81,6 +111,7 @@ public:
*
* @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);
};
diff --git a/arm_compute/runtime/GLES_COMPUTE/functions/GCScale.h b/arm_compute/runtime/GLES_COMPUTE/functions/GCScale.h
index d4295d57fa..7d0689dbce 100644
--- a/arm_compute/runtime/GLES_COMPUTE/functions/GCScale.h
+++ b/arm_compute/runtime/GLES_COMPUTE/functions/GCScale.h
@@ -24,7 +24,7 @@
#ifndef ARM_COMPUTE_GCSCALE_H
#define ARM_COMPUTE_GCSCALE_H
-#include "arm_compute/core/Types.h"
+#include "arm_compute/core/KernelDescriptors.h"
#include "arm_compute/runtime/GLES_COMPUTE/IGCSimpleFunction.h"
#include <cstdint>
@@ -49,8 +49,17 @@ public:
* @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(IGCTensor *input, IGCTensor *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 types supported: F16. (Written to only for @p border_mode != UNDEFINED)
+ * @param[out] output Destination tensor. Data types 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 descriptor to be used to configure
+ */
+ void configure(IGCTensor *input, IGCTensor *output, const ScaleKernelInfo &info);
};
}
#endif /*ARM_COMPUTE_GCSCALE_H */
diff --git a/arm_compute/runtime/NEON/functions/NEScale.h b/arm_compute/runtime/NEON/functions/NEScale.h
index f77b043f0f..30bcdc168b 100644
--- a/arm_compute/runtime/NEON/functions/NEScale.h
+++ b/arm_compute/runtime/NEON/functions/NEScale.h
@@ -56,6 +56,7 @@ public:
* @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.
@@ -78,6 +79,7 @@ public:
*
* @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
diff --git a/examples/cl_events.cpp b/examples/cl_events.cpp
index a9c508ac58..bc3c2b6d2f 100644
--- a/examples/cl_events.cpp
+++ b/examples/cl_events.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -67,7 +67,7 @@ public:
tmp_median_gauss.allocator()->init(dst_info);
//Configure the functions:
- scale.configure(&src, &tmp_scale_median, InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::REPLICATE);
+ scale.configure(&src, &tmp_scale_median, ScaleKernelInfo{ InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::REPLICATE });
median.configure(&tmp_scale_median, &tmp_median_gauss, BorderMode::REPLICATE);
gauss.configure(&tmp_median_gauss, &dst, BorderMode::REPLICATE);
diff --git a/examples/neon_scale.cpp b/examples/neon_scale.cpp
index b04d916aaf..81bf685f9d 100644
--- a/examples/neon_scale.cpp
+++ b/examples/neon_scale.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -60,7 +60,7 @@ public:
dst.allocator()->init(dst_tensor_info);
// Configure Scale function object:
- scale.configure(&src, &dst, InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::UNDEFINED);
+ scale.configure(&src, &dst, ScaleKernelInfo{ InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::UNDEFINED });
// Allocate all the images
src.allocator()->allocate();
diff --git a/examples/neoncl_scale_median_gaussian.cpp b/examples/neoncl_scale_median_gaussian.cpp
index 1b26517d9f..f0e4a31148 100644
--- a/examples/neoncl_scale_median_gaussian.cpp
+++ b/examples/neoncl_scale_median_gaussian.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -71,7 +71,7 @@ public:
median_gauss.allocator()->init(scale_median_info);
dst.allocator()->init(scale_median_info);
- scale.configure(&src, &scale_median, InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::REPLICATE);
+ scale.configure(&src, &scale_median, ScaleKernelInfo{ InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::REPLICATE });
median.configure(&scale_median, &median_gauss, BorderMode::REPLICATE);
gauss.configure(&median_gauss, &dst, BorderMode::REPLICATE);
diff --git a/src/core/CL/kernels/CLScaleKernel.cpp b/src/core/CL/kernels/CLScaleKernel.cpp
index e19da32ac3..872ba5b6cc 100644
--- a/src/core/CL/kernels/CLScaleKernel.cpp
+++ b/src/core/CL/kernels/CLScaleKernel.cpp
@@ -60,7 +60,7 @@ inline std::pair<float, float> calculate_scale_factors(const ITensorInfo &input,
return std::make_pair(wr, hr);
}
-Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, InterpolationPolicy policy, SamplingPolicy sampling_policy, bool align_corners)
+Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, const ScaleKernelInfo &info)
{
ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(input);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QASYMM8, DataType::QASYMM8_SIGNED, DataType::U8, DataType::S16, DataType::F16, DataType::F32);
@@ -68,9 +68,9 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, I
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(input, output);
ARM_COMPUTE_RETURN_ERROR_ON(output == input);
- ARM_COMPUTE_RETURN_ERROR_ON(align_corners && !is_align_corners_allowed(sampling_policy));
+ ARM_COMPUTE_RETURN_ERROR_ON(info.align_corners && !is_align_corners_allowed(info.sampling_policy));
- if(align_corners)
+ if(info.align_corners)
{
// For bilinear method with aligned corners, the resize ratio will
// be calculated by (input_size - 1)/(output_size - 1). Belows are
@@ -90,14 +90,14 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, I
float wr = 0.f;
float hr = 0.f;
- std::tie(wr, hr) = calculate_scale_factors(*input, *output, align_corners);
+ std::tie(wr, hr) = calculate_scale_factors(*input, *output, info.align_corners);
- ARM_COMPUTE_RETURN_ERROR_ON(policy == InterpolationPolicy::AREA && (wr > 1.f || hr > 1.f));
+ ARM_COMPUTE_RETURN_ERROR_ON(info.interpolation_policy == InterpolationPolicy::AREA && (wr > 1.f || hr > 1.f));
return Status{};
}
-std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITensorInfo *output, InterpolationPolicy policy, BorderMode border_mode, SamplingPolicy sampling_policy, BorderSize &border)
+std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITensorInfo *output, const ScaleKernelInfo &info, BorderSize &border)
{
Window win{};
bool window_changed{};
@@ -108,7 +108,7 @@ std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITen
{
case DataLayout::NCHW:
{
- if(border_mode == BorderMode::UNDEFINED)
+ if(info.border_mode == BorderMode::UNDEFINED)
{
border = BorderSize(0);
}
@@ -124,9 +124,9 @@ std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITen
output_access.set_valid_region(win, calculate_valid_region_scale(*(input),
output->tensor_shape(),
- policy,
- sampling_policy,
- border_mode == BorderMode::UNDEFINED));
+ info.interpolation_policy,
+ info.sampling_policy,
+ info.border_mode == BorderMode::UNDEFINED));
window_changed = update_window_and_padding(win, input_access, output_access);
}
@@ -158,13 +158,12 @@ BorderSize CLScaleKernel::border_size() const
return BorderSize(1);
}
-Status CLScaleKernel::validate(const ITensorInfo *input, const ITensorInfo *output, InterpolationPolicy policy,
- BorderMode border_mode, SamplingPolicy sampling_policy, bool align_corners)
+Status CLScaleKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const ScaleKernelInfo &info)
{
BorderSize border = BorderSize(1);
- ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, policy, sampling_policy, align_corners));
- ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), output->clone().get(), policy, border_mode, sampling_policy, border).first);
+ ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, info));
+ ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), output->clone().get(), info, border).first);
return Status{};
}
@@ -179,27 +178,26 @@ const ICLTensor *CLScaleKernel::output() const
return _output;
}
-void CLScaleKernel::configure(const ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode, SamplingPolicy sampling_policy, bool align_corners)
+void CLScaleKernel::configure(const ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info)
{
- configure(CLKernelLibrary::get().get_compile_context(), input, output, policy, border_mode, sampling_policy, align_corners);
+ configure(CLKernelLibrary::get().get_compile_context(), input, output, info);
}
-void CLScaleKernel::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode, SamplingPolicy sampling_policy,
- bool align_corners)
+void CLScaleKernel::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info)
{
- ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), policy, sampling_policy, align_corners));
+ ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), info));
- _input = input;
- _output = output;
- _interpolationPolicy = policy;
- _data_layout = input->info()->data_layout();
- _align_corners = align_corners;
+ _input = input;
+ _output = output;
+ _interpolation_policy = info.interpolation_policy;
+ _data_layout = input->info()->data_layout();
+ _align_corners = info.align_corners;
float wr = 0.f;
float hr = 0.f;
std::tie(wr, hr) = calculate_scale_factors(*input->info(), *output->info(), _align_corners);
- const bool call_quantized_kernel = is_data_type_quantized_asymmetric(input->info()->data_type()) && policy == InterpolationPolicy::BILINEAR;
+ const bool call_quantized_kernel = is_data_type_quantized_asymmetric(input->info()->data_type()) && _interpolation_policy == InterpolationPolicy::BILINEAR;
const int idx_width = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::WIDTH);
const int idx_height = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::HEIGHT);
@@ -208,14 +206,15 @@ void CLScaleKernel::configure(const CLCompileContext &compile_context, const ICL
// Compute actual border size
BorderSize border = border_size();
+ auto interpolation_policy_to_use = _interpolation_policy;
// Area interpolation behaves as Nearest Neighbour in case of up-sampling
- if(policy == InterpolationPolicy::AREA && wr <= 1.f && hr <= 1.f)
+ if(_interpolation_policy == InterpolationPolicy::AREA && wr <= 1.f && hr <= 1.f)
{
- policy = InterpolationPolicy::NEAREST_NEIGHBOR;
+ interpolation_policy_to_use = InterpolationPolicy::NEAREST_NEIGHBOR;
}
// Configure kernel window
- auto win_config = validate_and_configure_window(input->info(), output->info(), policy, border_mode, sampling_policy, border);
+ auto win_config = validate_and_configure_window(input->info(), output->info(), info, border);
ARM_COMPUTE_ERROR_THROW_ON(win_config.first);
ICLKernel::configure_internal(win_config.second);
@@ -223,9 +222,9 @@ void CLScaleKernel::configure(const CLCompileContext &compile_context, const ICL
CLBuildOptions build_opts;
build_opts.add_option("-DDATA_TYPE=" + get_cl_type_from_data_type(input->info()->data_type()));
build_opts.add_option("-DBORDER_SIZE=" + support::cpp11::to_string(border.right));
- build_opts.add_option_if(border_mode == BorderMode::REPLICATE, "-DBORDER_MODE_REPLICATE");
+ build_opts.add_option_if(info.border_mode == BorderMode::REPLICATE, "-DBORDER_MODE_REPLICATE");
build_opts.add_option_if(is_nhwc, "-DDEPTH_OUT=" + support::cpp11::to_string(output->info()->dimension(2)));
- build_opts.add_option_if_else(sampling_policy == SamplingPolicy::CENTER, "-DSAMPLING_POLICY_CENTER", "-DSAMPLING_POLICY_TOP_LEFT");
+ build_opts.add_option_if_else(info.sampling_policy == SamplingPolicy::CENTER, "-DSAMPLING_POLICY_CENTER", "-DSAMPLING_POLICY_TOP_LEFT");
if(call_quantized_kernel)
{
const UniformQuantizationInfo qinfo = input->info()->quantization_info().uniform();
@@ -233,7 +232,7 @@ void CLScaleKernel::configure(const CLCompileContext &compile_context, const ICL
build_opts.add_option("-DOFFSET=" + support::cpp11::to_string(qinfo.offset));
}
- std::string interpolation_name = string_from_interpolation_policy(policy);
+ std::string interpolation_name = string_from_interpolation_policy(interpolation_policy_to_use);
std::transform(interpolation_name.begin(), interpolation_name.end(), interpolation_name.begin(), ::tolower);
std::string kernel_name = "scale_" + interpolation_name;
kernel_name += call_quantized_kernel ? "_quantized_" : "_";
@@ -252,8 +251,8 @@ void CLScaleKernel::configure(const CLCompileContext &compile_context, const ICL
// Set config_id for enabling LWS tuning
_config_id = "scale_";
- _config_id += (border_mode == BorderMode::REPLICATE ? "Bord_rep" : "");
- _config_id += (sampling_policy == SamplingPolicy::CENTER ? "center" : "topleft");
+ _config_id += (info.border_mode == BorderMode::REPLICATE ? "Bord_rep" : "");
+ _config_id += (info.sampling_policy == SamplingPolicy::CENTER ? "center" : "topleft");
_config_id += (is_nhwc ? "nhwc" : "nchw");
_config_id += "_";
_config_id += support::cpp11::to_string(output->info()->dimension(0));
diff --git a/src/core/GLES_COMPUTE/kernels/GCScaleKernel.cpp b/src/core/GLES_COMPUTE/kernels/GCScaleKernel.cpp
index a85a0e7e98..8c268ca374 100644
--- a/src/core/GLES_COMPUTE/kernels/GCScaleKernel.cpp
+++ b/src/core/GLES_COMPUTE/kernels/GCScaleKernel.cpp
@@ -45,13 +45,13 @@ BorderSize GCScaleKernel::border_size() const
return BorderSize(1);
}
-void GCScaleKernel::configure(const IGCTensor *input, IGCTensor *output, InterpolationPolicy policy, bool border_undefined, SamplingPolicy sampling_policy)
+void GCScaleKernel::configure(const IGCTensor *input, IGCTensor *output, const ScaleKernelInfo &info)
{
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::F16);
ARM_COMPUTE_ERROR_ON_NULLPTR(output);
ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(input, output);
ARM_COMPUTE_ERROR_ON(output == input);
- ARM_COMPUTE_ERROR_ON(policy != InterpolationPolicy::NEAREST_NEIGHBOR);
+ ARM_COMPUTE_ERROR_ON(info.interpolation_policy != InterpolationPolicy::NEAREST_NEIGHBOR);
_input = input;
_output = output;
@@ -61,16 +61,18 @@ void GCScaleKernel::configure(const IGCTensor *input, IGCTensor *output, Interpo
const auto hr = static_cast<float>(input->info()->dimension(1)) / static_cast<float>(output->info()->dimension(1));
// Compute actual border size
- BorderSize border = border_undefined ? BorderSize(0) : border_size();
+ const bool border_undefined = info.border_mode == BorderMode::UNDEFINED;
+ BorderSize border = border_undefined ? BorderSize(0) : border_size();
// Area interpolation behaves as Nearest Neighbour in case of up-sampling
- if(policy == InterpolationPolicy::AREA && wr <= 1.f && hr <= 1.f)
+ auto interpolation_policy_to_use = info.interpolation_policy;
+ if(interpolation_policy_to_use == InterpolationPolicy::AREA && wr <= 1.f && hr <= 1.f)
{
- policy = InterpolationPolicy::NEAREST_NEIGHBOR;
+ interpolation_policy_to_use = InterpolationPolicy::NEAREST_NEIGHBOR;
}
else
{
- ARM_COMPUTE_ERROR_ON(policy == InterpolationPolicy::AREA);
+ ARM_COMPUTE_ERROR_ON(interpolation_policy_to_use == InterpolationPolicy::AREA);
}
// Create kernel
@@ -81,7 +83,7 @@ void GCScaleKernel::configure(const IGCTensor *input, IGCTensor *output, Interpo
build_opts.emplace("#define DATA_TYPE_FP16");
build_opts.emplace("#define BORDER_SIZE " + support::cpp11::to_string(border.right));
- if(sampling_policy == SamplingPolicy::TOP_LEFT)
+ if(info.sampling_policy == SamplingPolicy::TOP_LEFT)
{
build_opts.emplace("#define SAMPLING_POLICY_TOP_LEFT");
}
@@ -106,7 +108,7 @@ void GCScaleKernel::configure(const IGCTensor *input, IGCTensor *output, Interpo
build_opts.emplace("#define SCALE_NEAREST_GENERIC");
}
- std::string interpolation_name = string_from_interpolation_policy(policy); // NOLINT
+ std::string interpolation_name = string_from_interpolation_policy(interpolation_policy_to_use); // NOLINT
std::transform(interpolation_name.begin(), interpolation_name.end(), interpolation_name.begin(), ::tolower);
std::string kernel_name = "scale_" + interpolation_name;
_kernel = GCKernelLibrary::get().create_kernel(kernel_name, build_opts);
@@ -130,8 +132,8 @@ void GCScaleKernel::configure(const IGCTensor *input, IGCTensor *output, Interpo
output_access.set_valid_region(win, calculate_valid_region_scale(*(input->info()),
output->info()->tensor_shape(),
- policy,
- sampling_policy,
+ info.interpolation_policy,
+ info.sampling_policy,
border_undefined));
IGCKernel::configure(win);
diff --git a/src/runtime/CL/functions/CLCropResize.cpp b/src/runtime/CL/functions/CLCropResize.cpp
index 17fc80e146..aa6f1f913d 100644
--- a/src/runtime/CL/functions/CLCropResize.cpp
+++ b/src/runtime/CL/functions/CLCropResize.cpp
@@ -135,7 +135,7 @@ void CLCropResize::configure(const CLCompileContext &compile_context, const ICLT
configure_crop(_input, _boxes, _box_ind, _crop_results[num_box].get(), num_box, start, end, batch_index);
auto scale_kernel = support::cpp14::make_unique<CLScale>();
- scale_kernel->configure(compile_context, _crop_results[num_box].get(), _scaled_results[num_box].get(), _method, BorderMode::CONSTANT, PixelValue(_extrapolation_value), SamplingPolicy::TOP_LEFT);
+ scale_kernel->configure(compile_context, _crop_results[num_box].get(), _scaled_results[num_box].get(), ScaleKernelInfo{ _method, BorderMode::CONSTANT, PixelValue(_extrapolation_value), SamplingPolicy::TOP_LEFT });
_scale.emplace_back(std::move(scale_kernel));
Window win = calculate_max_window(*_output->info());
diff --git a/src/runtime/CL/functions/CLGaussianPyramid.cpp b/src/runtime/CL/functions/CLGaussianPyramid.cpp
index 1ac98787ac..5dd1aacef1 100644
--- a/src/runtime/CL/functions/CLGaussianPyramid.cpp
+++ b/src/runtime/CL/functions/CLGaussianPyramid.cpp
@@ -175,7 +175,7 @@ void CLGaussianPyramidOrb::configure(const CLCompileContext &compile_context, IC
_gauss5x5[i].configure(compile_context, _pyramid->get_pyramid_level(i), _tmp.get_pyramid_level(i), border_mode, constant_border_value);
/* Configure scale image kernel */
- _scale_nearest[i].configure(compile_context, _tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1), InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, SamplingPolicy::CENTER);
+ _scale_nearest[i].configure(compile_context, _tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1), ScaleKernelInfo{ InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, PixelValue(), SamplingPolicy::CENTER });
}
_tmp.allocate();
diff --git a/src/runtime/CL/functions/CLLaplacianReconstruct.cpp b/src/runtime/CL/functions/CLLaplacianReconstruct.cpp
index ea6a3f9a98..113a2b9e54 100644
--- a/src/runtime/CL/functions/CLLaplacianReconstruct.cpp
+++ b/src/runtime/CL/functions/CLLaplacianReconstruct.cpp
@@ -77,7 +77,7 @@ void CLLaplacianReconstruct::configure(const CLCompileContext &compile_context,
// Scale levels n-1 to 1, and add levels n-2 to 0
for(size_t l = 0; l < last_level; ++l)
{
- _scalef[l].configure(compile_context, _tmp_pyr.get_pyramid_level(l + 1), _tmp_pyr.get_pyramid_level(l), arm_compute::InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, constant_border_value);
+ _scalef[l].configure(compile_context, _tmp_pyr.get_pyramid_level(l + 1), _tmp_pyr.get_pyramid_level(l), ScaleKernelInfo{ arm_compute::InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, constant_border_value });
_addf[l].configure(compile_context, _tmp_pyr.get_pyramid_level(l), pyramid->get_pyramid_level(l), _tmp_pyr.get_pyramid_level(l), ConvertPolicy::SATURATE);
}
diff --git a/src/runtime/CL/functions/CLScale.cpp b/src/runtime/CL/functions/CLScale.cpp
index a9395bdc3d..7e58b76f8d 100644
--- a/src/runtime/CL/functions/CLScale.cpp
+++ b/src/runtime/CL/functions/CLScale.cpp
@@ -30,38 +30,53 @@
#include "arm_compute/runtime/CL/CLScheduler.h"
#include "support/MemorySupport.h"
-using namespace arm_compute;
+namespace arm_compute
+{
+void CLScale::configure(ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info)
+{
+ configure(CLKernelLibrary::get().get_compile_context(), input, output, info);
+}
void CLScale::configure(ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value, SamplingPolicy sampling_policy, bool use_padding,
bool align_corners)
{
- configure(CLKernelLibrary::get().get_compile_context(), input, output, policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners);
+ configure(CLKernelLibrary::get().get_compile_context(), input, output, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners });
}
-void CLScale::configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value,
- SamplingPolicy sampling_policy, bool use_padding, bool align_corners)
+void CLScale::configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info)
{
- ARM_COMPUTE_UNUSED(use_padding);
auto k = arm_compute::support::cpp14::make_unique<CLScaleKernel>();
k->set_target(CLScheduler::get().target());
- k->configure(compile_context, input, output, policy, border_mode, sampling_policy, align_corners);
+ k->configure(compile_context, input, output, info);
_kernel = std::move(k);
// Tune kernels
CLScheduler::get().tune_kernel_static(*_kernel);
+ auto border_mode_to_use = info.border_mode;
// In the case of NHWC we can't have undefined border mode as this would require to access elements outside z dimension,
// so we treat it like border constant.
- if(border_mode == BorderMode::UNDEFINED && input->info()->data_layout() == DataLayout::NHWC)
+ if(info.border_mode == BorderMode::UNDEFINED && input->info()->data_layout() == DataLayout::NHWC)
{
- border_mode = BorderMode::CONSTANT;
+ border_mode_to_use = BorderMode::CONSTANT;
}
- _border_handler.configure(compile_context, input, _kernel->border_size(), border_mode, constant_border_value);
+ _border_handler.configure(compile_context, input, _kernel->border_size(), border_mode_to_use, info.constant_border_value);
+}
+
+void CLScale::configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value,
+ SamplingPolicy sampling_policy, bool use_padding, bool align_corners)
+{
+ configure(compile_context, input, output, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners });
}
Status CLScale::validate(const ITensorInfo *input, const ITensorInfo *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value, SamplingPolicy sampling_policy,
bool use_padding, bool align_corners)
{
- ARM_COMPUTE_UNUSED(constant_border_value, use_padding);
- return CLScaleKernel::validate(input, output, policy, border_mode, sampling_policy, align_corners);
+ return CLScale::validate(input, output, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners });
+}
+
+Status CLScale::validate(const ITensorInfo *input, const ITensorInfo *output, const ScaleKernelInfo &info)
+{
+ return CLScaleKernel::validate(input, output, info);
}
+} // namespace arm_compute
diff --git a/src/runtime/CL/tuners/BifrostTuner.cpp b/src/runtime/CL/tuners/BifrostTuner.cpp
index 5b23baaed3..3df09ebd74 100644
--- a/src/runtime/CL/tuners/BifrostTuner.cpp
+++ b/src/runtime/CL/tuners/BifrostTuner.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019 ARM Limited.
+ * Copyright (c) 2018-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -255,7 +255,7 @@ void tune_scale_kernel(CLScaleKernel &k)
cl::NDRange lws_hint = k.lws_hint();
const GPUTarget gpu_target = k.get_target();
const DataType dt = k.input()->info()->data_type();
- const InterpolationPolicy interpolation = k._interpolationPolicy;
+ const InterpolationPolicy interpolation = k.get_interpolation_policy();
// Configure the local work size for Bifrost, interpolation (bilinear) and datatype F32.
// The value are obtained via exhaustive autotuning.
diff --git a/src/runtime/GLES_COMPUTE/functions/GCScale.cpp b/src/runtime/GLES_COMPUTE/functions/GCScale.cpp
index f245c3ecd0..2902252017 100644
--- a/src/runtime/GLES_COMPUTE/functions/GCScale.cpp
+++ b/src/runtime/GLES_COMPUTE/functions/GCScale.cpp
@@ -29,14 +29,19 @@
#include "arm_compute/core/Validate.h"
#include "support/MemorySupport.h"
-using namespace arm_compute;
-
+namespace arm_compute
+{
void GCScale::configure(IGCTensor *input, IGCTensor *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value, SamplingPolicy sampling_policy, bool use_padding,
bool align_corners)
{
- ARM_COMPUTE_UNUSED(use_padding, align_corners);
+ configure(input, output, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners });
+}
+
+void GCScale::configure(IGCTensor *input, IGCTensor *output, const ScaleKernelInfo &info)
+{
auto k = arm_compute::support::cpp14::make_unique<GCScaleKernel>();
- k->configure(input, output, policy, border_mode == BorderMode::UNDEFINED, sampling_policy);
+ k->configure(input, output, info);
_kernel = std::move(k);
- _border_handler.configure(input, _kernel->border_size(), border_mode, constant_border_value);
+ _border_handler.configure(input, _kernel->border_size(), info.border_mode, info.constant_border_value);
}
+} // namespace arm_compute
diff --git a/src/runtime/NEON/functions/NECropResize.cpp b/src/runtime/NEON/functions/NECropResize.cpp
index cc39d0284e..3a7ff52a89 100644
--- a/src/runtime/NEON/functions/NECropResize.cpp
+++ b/src/runtime/NEON/functions/NECropResize.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 ARM Limited.
+ * Copyright (c) 2019-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -111,7 +111,7 @@ void NECropResize::run()
NEScheduler::get().schedule(_crop[i].get(), Window::DimZ);
// Scale the cropped image.
- _scale[i]->configure(_crop_results[i].get(), _scaled_results[i].get(), _method, BorderMode::CONSTANT, PixelValue(_extrapolation_value), SamplingPolicy::TOP_LEFT, false);
+ _scale[i]->configure(_crop_results[i].get(), _scaled_results[i].get(), ScaleKernelInfo{ _method, BorderMode::CONSTANT, PixelValue(_extrapolation_value), SamplingPolicy::TOP_LEFT, false });
_scaled_results[i]->allocator()->allocate();
_scale[i]->run();
diff --git a/src/runtime/NEON/functions/NEGaussianPyramid.cpp b/src/runtime/NEON/functions/NEGaussianPyramid.cpp
index d08bf1e282..478828efc0 100644
--- a/src/runtime/NEON/functions/NEGaussianPyramid.cpp
+++ b/src/runtime/NEON/functions/NEGaussianPyramid.cpp
@@ -168,7 +168,7 @@ void NEGaussianPyramidOrb::configure(const ITensor *input, IPyramid *pyramid, Bo
_gaus5x5[i].configure(_pyramid->get_pyramid_level(i), _tmp.get_pyramid_level(i), border_mode, constant_border_value);
/* Configure scale */
- _scale_nearest[i].configure(_tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1), InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::UNDEFINED);
+ _scale_nearest[i].configure(_tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1), ScaleKernelInfo{ InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::UNDEFINED });
}
_tmp.allocate();
diff --git a/src/runtime/NEON/functions/NELaplacianReconstruct.cpp b/src/runtime/NEON/functions/NELaplacianReconstruct.cpp
index 9f7588edb0..997659ade5 100644
--- a/src/runtime/NEON/functions/NELaplacianReconstruct.cpp
+++ b/src/runtime/NEON/functions/NELaplacianReconstruct.cpp
@@ -73,7 +73,7 @@ void NELaplacianReconstruct::configure(const IPyramid *pyramid, ITensor *input,
// Scale levels n-1 to 1, and add levels n-2 to 0
for(size_t l = 0; l < last_level; ++l)
{
- _scalef[l].configure(_tmp_pyr.get_pyramid_level(l + 1), _tmp_pyr.get_pyramid_level(l), arm_compute::InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, constant_border_value);
+ _scalef[l].configure(_tmp_pyr.get_pyramid_level(l + 1), _tmp_pyr.get_pyramid_level(l), ScaleKernelInfo{ arm_compute::InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, constant_border_value });
_addf[l].configure(_tmp_pyr.get_pyramid_level(l), pyramid->get_pyramid_level(l), _tmp_pyr.get_pyramid_level(l), ConvertPolicy::SATURATE);
}
diff --git a/src/runtime/NEON/functions/NEScale.cpp b/src/runtime/NEON/functions/NEScale.cpp
index a5d3ac76a5..170b2ee3eb 100644
--- a/src/runtime/NEON/functions/NEScale.cpp
+++ b/src/runtime/NEON/functions/NEScale.cpp
@@ -37,8 +37,8 @@
#include <cstddef>
#include <utility>
-using namespace arm_compute;
-
+namespace arm_compute
+{
namespace
{
void precompute_dx_dy_offsets(ITensor *dx, ITensor *dy, ITensor *offsets, float wr, float hr, size_t input_element_size, SamplingPolicy sampling_policy)
@@ -237,3 +237,4 @@ void NEScale::run()
}
NEScheduler::get().schedule(&_scale_kernel, Window::DimY);
}
+} // namespace arm_compute
diff --git a/tests/benchmark/fixtures/ScaleFixture.h b/tests/benchmark/fixtures/ScaleFixture.h
index b2fbd9c3b6..4f2948331b 100644
--- a/tests/benchmark/fixtures/ScaleFixture.h
+++ b/tests/benchmark/fixtures/ScaleFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -75,7 +75,7 @@ public:
dst = create_tensor<TensorType>(shape_scaled, data_type);
// Create and configure function
- scale_func.configure(&src, &dst, policy, border_mode, constant_border_value, sampling_policy);
+ scale_func.configure(&src, &dst, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy });
// Allocate tensors
src.allocator()->allocate();
diff --git a/tests/benchmark/fixtures/ScaleLayerFixture.h b/tests/benchmark/fixtures/ScaleLayerFixture.h
index 10568ea531..dcfe5e223f 100644
--- a/tests/benchmark/fixtures/ScaleLayerFixture.h
+++ b/tests/benchmark/fixtures/ScaleLayerFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -61,7 +61,7 @@ public:
shape_scaled.set(1, shape[1] * scale_y);
dst = create_tensor<TensorType>(shape_scaled, data_type);
- scale_layer.configure(&src, &dst, policy, border_mode, constant_border_value, sampling_policy);
+ scale_layer.configure(&src, &dst, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy });
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
diff --git a/tests/validation/CL/Scale.cpp b/tests/validation/CL/Scale.cpp
index d1c0d5ddf1..e7e481b68e 100644
--- a/tests/validation/CL/Scale.cpp
+++ b/tests/validation/CL/Scale.cpp
@@ -121,7 +121,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
input_info, output_info, policy, border_mode, expected)
{
Status status = CLScale::validate(&input_info.clone()->set_is_resizable(false),
- &output_info.clone()->set_is_resizable(false), policy, border_mode);
+ &output_info.clone()->set_is_resizable(false), ScaleKernelInfo{policy, border_mode});
ARM_COMPUTE_EXPECT(bool(status) == expected, framework::LogLevel::ERRORS);
}
@@ -153,7 +153,7 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combi
// Create and configure function
CLScale clscale;
- clscale.configure(&src, &dst, policy, border_mode, constant_border_value, sampling_policy);
+ clscale.configure(&src, &dst, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy });
// Get border size depending on border mode
const BorderSize border_size(border_mode == BorderMode::UNDEFINED ? 0 : 1);
diff --git a/tests/validation/GLES_COMPUTE/Scale.cpp b/tests/validation/GLES_COMPUTE/Scale.cpp
index e6526b8445..7a88159481 100644
--- a/tests/validation/GLES_COMPUTE/Scale.cpp
+++ b/tests/validation/GLES_COMPUTE/Scale.cpp
@@ -90,7 +90,7 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combi
// Create and configure function
GCScale gcscale;
- gcscale.configure(&src, &dst, policy, border_mode, constant_border_value, sampling_policy);
+ gcscale.configure(&src, &dst, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy });
// Get border size depending on border mode
const BorderSize border_size(border_mode == BorderMode::UNDEFINED ? 0 : 1);
diff --git a/tests/validation/NEON/Scale.cpp b/tests/validation/NEON/Scale.cpp
index c1c17ee46c..29405ccfd6 100644
--- a/tests/validation/NEON/Scale.cpp
+++ b/tests/validation/NEON/Scale.cpp
@@ -253,16 +253,10 @@ TEST_CASE(NullPtr, framework::DatasetMode::ALL)
Status result{};
// nullptr is given as input
- result = NEScale::validate(nullptr, &output, default_interpolation_policy, default_border_mode);
- ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
-
result = NEScale::validate(nullptr, &output, ScaleKernelInfo{ default_interpolation_policy, default_border_mode });
ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
// nullptr is given as output
- result = NEScale::validate(&input, nullptr, default_interpolation_policy, default_border_mode);
- ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
-
result = NEScale::validate(&input, nullptr, ScaleKernelInfo{ default_interpolation_policy, default_border_mode });
ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
}
@@ -301,9 +295,6 @@ TEST_CASE(SupportDataType, framework::DatasetMode::ALL)
const auto input = TensorInfo{ input_shape, 1, kv.first, default_data_layout };
const auto output = TensorInfo{ output_shape, 1, kv.first, default_data_layout };
- result = NEScale::validate(&input, &output, default_interpolation_policy, default_border_mode);
- ARM_COMPUTE_EXPECT(bool(result) == kv.second, framework::LogLevel::ERRORS);
-
result = NEScale::validate(&input, &output, ScaleKernelInfo{ default_interpolation_policy, default_border_mode });
ARM_COMPUTE_EXPECT(bool(result) == kv.second, framework::LogLevel::ERRORS);
}
@@ -317,9 +308,6 @@ TEST_CASE(MissmatchingDataType, framework::DatasetMode::ALL)
const auto output = TensorInfo{ output_shape, 1, non_default_data_type, default_data_layout };
Status result{};
- result = NEScale::validate(&input, &output, default_interpolation_policy, default_border_mode);
- ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
-
result = NEScale::validate(&input, &output, ScaleKernelInfo{ default_interpolation_policy, default_border_mode });
ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
}
@@ -334,9 +322,6 @@ TEST_CASE(UsePadding, framework::DatasetMode::ALL)
constexpr auto border_mode = BorderMode::UNDEFINED;
constexpr bool use_padding = false;
- result = NEScale::validate(&input, &output, default_interpolation_policy, border_mode, PixelValue(), default_sampling_policy, use_padding);
- ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
-
result = NEScale::validate(&input, &output, ScaleKernelInfo{ default_interpolation_policy, border_mode, PixelValue(), default_sampling_policy, use_padding });
ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
}
@@ -351,9 +336,6 @@ TEST_CASE(AreaWithNHWC, framework::DatasetMode::ALL)
const auto output = TensorInfo{ output_shape, 1, default_data_type, data_layout };
Status result{};
- result = NEScale::validate(&input, &output, interpolation_policy, default_border_mode);
- ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
-
result = NEScale::validate(&input, &output, ScaleKernelInfo{ interpolation_policy, default_border_mode });
ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
}
@@ -369,9 +351,6 @@ TEST_CASE(AreaWithNonU8, framework::DatasetMode::ALL)
const auto output = TensorInfo{ output_shape, 1, data_type, data_layout };
Status result{};
- result = NEScale::validate(&input, &output, interpolation_policy, default_border_mode);
- ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
-
result = NEScale::validate(&input, &output, ScaleKernelInfo{ interpolation_policy, default_border_mode });
ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
}
@@ -389,9 +368,6 @@ TEST_CASE(InvalidAlignedCornerOutput, framework::DatasetMode::ALL)
const auto output = TensorInfo{ invalid_output_shape, 1, default_data_type, default_data_layout };
Status result{};
- result = NEScale::validate(&input, &output, interpolation_policy, default_border_mode, PixelValue(), sampling_policy, default_use_padding, align_corners);
- ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
-
result = NEScale::validate(&input, &output, ScaleKernelInfo{ interpolation_policy, default_border_mode, PixelValue(), sampling_policy, default_use_padding, align_corners });
ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS);
}
diff --git a/tests/validation/fixtures/ScaleFixture.h b/tests/validation/fixtures/ScaleFixture.h
index f7ede917a6..199186f8e2 100644
--- a/tests/validation/fixtures/ScaleFixture.h
+++ b/tests/validation/fixtures/ScaleFixture.h
@@ -140,7 +140,7 @@ protected:
// Create and configure function
FunctionType scale;
- scale.configure(&src, &dst, _policy, _border_mode, _constant_border_value, _sampling_policy, /* use_padding */ true, _align_corners);
+ scale.configure(&src, &dst, ScaleKernelInfo{ _policy, _border_mode, _constant_border_value, _sampling_policy, /* use_padding */ true, _align_corners });
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);