aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormorgolock <pablo.tello@arm.com>2020-01-13 11:53:20 +0000
committerPablo Marquez <pablo.tello@arm.com>2020-01-14 11:42:00 +0000
commit6427c8233661f81053d1ad486b5914c612cef3d6 (patch)
tree283fd7a4bf331d3a687aba33e1705f92047c324d
parent9c700378f2227cb9d51455ed4a5086daaac5532a (diff)
downloadComputeLibrary-6427c8233661f81053d1ad486b5914c612cef3d6.tar.gz
COMPMID-2994: Add support QASYMM8_SIGNED in NEElementwiseSquareDiff
Updated interface documention and added precommit tests. Change-Id: I6d4fe250eb72d3daff977e5a98c1086692e3654a Signed-off-by: morgolock <pablo.tello@arm.com> Reviewed-on: https://review.mlplatform.org/c/2580 Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--arm_compute/runtime/NEON/functions/NEElementwiseOperations.h12
-rw-r--r--tests/validation/NEON/ElementwiseSquareDiff.cpp24
2 files changed, 28 insertions, 8 deletions
diff --git a/arm_compute/runtime/NEON/functions/NEElementwiseOperations.h b/arm_compute/runtime/NEON/functions/NEElementwiseOperations.h
index 9499867f81..eec9bb9fa9 100644
--- a/arm_compute/runtime/NEON/functions/NEElementwiseOperations.h
+++ b/arm_compute/runtime/NEON/functions/NEElementwiseOperations.h
@@ -33,7 +33,7 @@ class ITensor;
/** Basic function to run @ref NEArithmeticOperationKernel for max
*
- * @note The tensor data type for the inputs must be QASYMM8/S16/F16/S32/F32.
+ * @note The tensor data type for the inputs must be QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
* @note The function performs a max operation between two tensors.
*/
class NEElementwiseMax : public INESimpleFunction
@@ -59,8 +59,8 @@ public:
/** Basic function to run @ref NEArithmeticOperationKernel for min
*
- * @note The tensor data type for the inputs must be QASYMM8/S16/F16/S32/F32.
- * @note The function performs a max operation between two tensors.
+ * @note The tensor data type for the inputs must be QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
+ * @note The function performs a min operation between two tensors.
*/
class NEElementwiseMin : public INESimpleFunction
{
@@ -85,7 +85,7 @@ public:
/** Basic function to run @ref NEArithmeticOperationKernel for squared difference
*
- * @note The tensor data type for the inputs must be QASYMM8/S16/F16/S32/F32.
+ * @note The tensor data type for the inputs must be QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
* @note The function performs a squared different operation between two tensors (i.e., out[i] = (in1[i] - in2[i])^2
*/
class NEElementwiseSquaredDiff : public INESimpleFunction
@@ -93,14 +93,14 @@ class NEElementwiseSquaredDiff : public INESimpleFunction
public:
/** Initialise the kernel's inputs, output and conversion policy.
*
- * @param[in, out] input1 First tensor input. Data types supported: QASYMM8/S16/F16/S32/F32.
+ * @param[in, out] input1 First tensor input. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
* @param[in, out] input2 Second tensor input. Data types supported: Same as @p input1.
* @param[out] output Output tensor. Data types supported: Same as @p input1.
*/
void configure(ITensor *input1, ITensor *input2, ITensor *output);
/** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel for squared difference
*
- * @param[in] input1 First tensor input info. Data types supported: QASYMM8/S16/F16/S32/F32.
+ * @param[in] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
* @param[in] input2 Second tensor input info. Data types supported: Same as @p input1.
* @param[in] output Output tensor info. Data types supported: Same as @p input1.
*
diff --git a/tests/validation/NEON/ElementwiseSquareDiff.cpp b/tests/validation/NEON/ElementwiseSquareDiff.cpp
index 1a9ff8a4a6..cf55c6a66b 100644
--- a/tests/validation/NEON/ElementwiseSquareDiff.cpp
+++ b/tests/validation/NEON/ElementwiseSquareDiff.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019 ARM Limited.
+ * Copyright (c) 2018-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -51,6 +51,11 @@ RelativeTolerance<float> tolerance_fp16(0.01f);
const auto ElementwiseSquaredDiffQASYMM8Dataset = combine(combine(framework::dataset::make("DataType", DataType::QASYMM8), framework::dataset::make("DataType", DataType::QASYMM8)),
framework::dataset::make("DataType",
DataType::QASYMM8));
+
+const auto ElementwiseSquaredDiffQASYMM8SignedDataset = combine(combine(framework::dataset::make("DataType", DataType::QASYMM8_SIGNED), framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)),
+ framework::dataset::make("DataType",
+ DataType::QASYMM8_SIGNED));
+
/** Input data sets **/
const auto ElementwiseSquaredDiffS32Dataset = combine(combine(framework::dataset::make("DataType", DataType::S32), framework::dataset::make("DataType", DataType::S32)),
framework::dataset::make("DataType",
@@ -79,20 +84,23 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::S32),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S32), // Invalid data type combination
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
+ TensorInfo(TensorShape(1U, 1U, 2U), 1, DataType::QASYMM8_SIGNED), // Mismatching types
}),
framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S32),
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::S32),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(1U, 1U, 2U), 1, DataType::QASYMM8_SIGNED),
})),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S32),
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::S32),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S32),
TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(1U, 1U, 2U), 1, DataType::QASYMM8, QuantizationInfo(0.3f,1)),
})),
- framework::dataset::make("Expected", { true, true, true, false, false})),
+ framework::dataset::make("Expected", { true, true, true, false, false, false})),
input1_info, input2_info, output_info, expected)
{
ARM_COMPUTE_EXPECT(bool(NEElementwiseSquaredDiff::validate(&input1_info.clone()->set_is_resizable(false), &input2_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false))) == expected, framework::LogLevel::ERRORS);
@@ -197,6 +205,18 @@ FIXTURE_DATA_TEST_CASE(RunSmallBroadcast, NEElementwiseSquaredDiffQuantizedBroad
validate(Accessor(_target), _reference);
}
TEST_SUITE_END()
+
+TEST_SUITE(QASYMM8_SIGNED)
+FIXTURE_DATA_TEST_CASE(RunSmall, NEElementwiseSquaredDiffQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallShapes(),
+ ElementwiseSquaredDiffQASYMM8SignedDataset),
+ framework::dataset::make("QuantizationInfo", { QuantizationInfo(1.f, 5) })),
+ framework::dataset::make("QuantizationInfo", { QuantizationInfo(.5f, 5) })),
+ framework::dataset::make("QuantizationInfo", { QuantizationInfo(.2f, 5) })))
+{
+ // Validate output
+ validate(Accessor(_target), _reference);
+}
+TEST_SUITE_END()
TEST_SUITE_END()
TEST_SUITE(Float)