aboutsummaryrefslogtreecommitdiff
path: root/tests/validation_old
diff options
context:
space:
mode:
authorSanghoon Lee <sanghoon.lee@arm.com>2017-09-01 11:42:16 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commit72898feff6dd07153384ab41246b93e44d046b3b (patch)
treeab87ea2e2c59e90126246ac3d143f3186d15af42 /tests/validation_old
parent06b184ac568dc974986bae680957c4477f8ef6ca (diff)
downloadComputeLibrary-72898feff6dd07153384ab41246b93e44d046b3b.tar.gz
COMPMID-493: Port ArithmeticSubtraction to new validation
Change-Id: Ia49f337a8a574392ac0948fe65e9dca7a5fac2d0 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/86338 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests/validation_old')
-rw-r--r--tests/validation_old/CL/ArithmeticSubtraction.cpp288
-rw-r--r--tests/validation_old/NEON/ArithmeticSubtraction.cpp306
-rw-r--r--tests/validation_old/Reference.cpp17
-rw-r--r--tests/validation_old/Reference.h12
-rw-r--r--tests/validation_old/ReferenceCPP.cpp9
-rw-r--r--tests/validation_old/ReferenceCPP.h8
-rw-r--r--tests/validation_old/TensorOperations.h13
-rw-r--r--tests/validation_old/TensorVisitors.h18
8 files changed, 0 insertions, 671 deletions
diff --git a/tests/validation_old/CL/ArithmeticSubtraction.cpp b/tests/validation_old/CL/ArithmeticSubtraction.cpp
deleted file mode 100644
index 522ee7b1e8..0000000000
--- a/tests/validation_old/CL/ArithmeticSubtraction.cpp
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "CL/CLAccessor.h"
-#include "PaddingCalculator.h"
-#include "TypePrinter.h"
-#include "tests/AssetsLibrary.h"
-#include "tests/Globals.h"
-#include "tests/Utils.h"
-#include "tests/validation_old/Datasets.h"
-#include "tests/validation_old/Reference.h"
-#include "tests/validation_old/Validation.h"
-
-#include "arm_compute/core/Helpers.h"
-#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/functions/CLArithmeticSubtraction.h"
-#include "arm_compute/runtime/Tensor.h"
-#include "arm_compute/runtime/TensorAllocator.h"
-
-#include "tests/validation_old/boost_wrapper.h"
-
-#include <random>
-#include <string>
-
-using namespace arm_compute;
-using namespace arm_compute::test;
-using namespace arm_compute::test::validation;
-
-namespace
-{
-/** Compute Neon arithmetic subtraction function.
- *
- * @param[in] shape Shape of the input and output tensors.
- * @param[in] dt_in0 Data type of first input tensor.
- * @param[in] dt_in1 Data type of second input tensor.
- * @param[in] dt_out Data type of the output tensor.
- * @param[in] policy Overflow policy of the operation.
- * @param[in] fixed_point_position (Optional) Fixed point position that expresses the number of bits for the fractional part of the number when the tensor's data type is QS8 or QS16 (default = 0).
- *
- * @return Computed output tensor.
- */
-CLTensor compute_arithmetic_subtraction(const TensorShape &shape, DataType dt_in0, DataType dt_in1, DataType dt_out, ConvertPolicy policy, int fixed_point_position = 0)
-{
- // Create tensors
- CLTensor src1 = create_tensor<CLTensor>(shape, dt_in0, 1, fixed_point_position);
- CLTensor src2 = create_tensor<CLTensor>(shape, dt_in1, 1, fixed_point_position);
- CLTensor dst = create_tensor<CLTensor>(shape, dt_out, 1, fixed_point_position);
-
- // Create and configure function
- CLArithmeticSubtraction sub;
- sub.configure(&src1, &src2, &dst, policy);
-
- // Allocate tensors
- src1.allocator()->allocate();
- src2.allocator()->allocate();
- dst.allocator()->allocate();
-
- BOOST_TEST(!src1.info()->is_resizable());
- BOOST_TEST(!src2.info()->is_resizable());
- BOOST_TEST(!dst.info()->is_resizable());
-
- // Fill tensors
- library->fill_tensor_uniform(CLAccessor(src1), 0);
- library->fill_tensor_uniform(CLAccessor(src2), 1);
-
- // Compute function
- sub.run();
-
- return dst;
-}
-
-void validate_configuration(const CLTensor &src1, const CLTensor &src2, CLTensor &dst, TensorShape shape, ConvertPolicy policy)
-{
- BOOST_TEST(src1.info()->is_resizable());
- BOOST_TEST(src2.info()->is_resizable());
- BOOST_TEST(dst.info()->is_resizable());
-
- // Create and configure function
- CLArithmeticSubtraction sub;
- sub.configure(&src1, &src2, &dst, policy);
-
- // Validate valid region
- const ValidRegion valid_region = shape_to_valid_region(shape);
- validate(src1.info()->valid_region(), valid_region);
- validate(src2.info()->valid_region(), valid_region);
- validate(dst.info()->valid_region(), valid_region);
-
- // Validate padding
- const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding();
- validate(src1.info()->padding(), padding);
- validate(src2.info()->padding(), padding);
- validate(dst.info()->padding(), padding);
-}
-} // namespace
-
-#ifndef DOXYGEN_SKIP_THIS
-BOOST_AUTO_TEST_SUITE(CL)
-BOOST_AUTO_TEST_SUITE(ArithmeticSubtraction)
-
-BOOST_AUTO_TEST_SUITE(U8)
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP }),
- shape, policy)
-{
- // Create tensors
- CLTensor src1 = create_tensor<CLTensor>(shape, DataType::U8);
- CLTensor src2 = create_tensor<CLTensor>(shape, DataType::U8);
- CLTensor dst = create_tensor<CLTensor>(shape, DataType::U8);
-
- validate_configuration(src1, src2, dst, shape, policy);
-}
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
-BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP }),
- shape, policy)
-{
- // Compute function
- CLTensor dst = compute_arithmetic_subtraction(shape, DataType::U8, DataType::U8, DataType::U8, policy);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, DataType::U8, DataType::U8, DataType::U8, policy);
-
- // Validate output
- validate(CLAccessor(dst), ref_dst);
-}
-BOOST_AUTO_TEST_SUITE_END()
-
-BOOST_AUTO_TEST_SUITE(S16)
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ DataType::U8, DataType::S16 }) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP }),
- shape, dt, policy)
-{
- // Create tensors
- CLTensor src1 = create_tensor<CLTensor>(shape, dt);
- CLTensor src2 = create_tensor<CLTensor>(shape, DataType::S16);
- CLTensor dst = create_tensor<CLTensor>(shape, DataType::S16);
-
- validate_configuration(src1, src2, dst, shape, policy);
-}
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
-BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ DataType::U8, DataType::S16 }) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP }),
- shape, dt, policy)
-{
- // Compute function
- CLTensor dst = compute_arithmetic_subtraction(shape, dt, DataType::S16, DataType::S16, policy);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, dt, DataType::S16, DataType::S16, policy);
-
- // Validate output
- validate(CLAccessor(dst), ref_dst);
-}
-BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ DataType::U8, DataType::S16 }) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP }),
- shape, dt, policy)
-{
- // Compute function
- CLTensor dst = compute_arithmetic_subtraction(shape, dt, DataType::S16, DataType::S16, policy);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, dt, DataType::S16, DataType::S16, policy);
-
- // Validate output
- validate(CLAccessor(dst), ref_dst);
-}
-BOOST_AUTO_TEST_SUITE_END()
-
-BOOST_AUTO_TEST_SUITE(Quantized)
-BOOST_AUTO_TEST_SUITE(QS8)
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
-BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * ConvertPolicies() * boost::unit_test::data::xrange(1, 7),
- shape, policy, fixed_point_position)
-{
- // Compute function
- CLTensor dst = compute_arithmetic_subtraction(shape, DataType::QS8, DataType::QS8, DataType::QS8, policy, fixed_point_position);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, DataType::QS8, DataType::QS8, DataType::QS8, policy, fixed_point_position);
-
- // Validate output
- validate(CLAccessor(dst), ref_dst);
-}
-BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * ConvertPolicies() * boost::unit_test::data::xrange(1, 7),
- shape, policy, fixed_point_position)
-{
- // Compute function
- CLTensor dst = compute_arithmetic_subtraction(shape, DataType::QS8, DataType::QS8, DataType::QS8, policy, fixed_point_position);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, DataType::QS8, DataType::QS8, DataType::QS8, policy, fixed_point_position);
-
- // Validate output
- validate(CLAccessor(dst), ref_dst);
-}
-BOOST_AUTO_TEST_SUITE_END()
-
-BOOST_AUTO_TEST_SUITE(QS16)
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
-BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * ConvertPolicies() * boost::unit_test::data::xrange(1, 15),
- shape, policy, fixed_point_position)
-{
- // Compute function
- CLTensor dst = compute_arithmetic_subtraction(shape, DataType::QS16, DataType::QS16, DataType::QS16, policy, fixed_point_position);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, DataType::QS16, DataType::QS16, DataType::QS16, policy, fixed_point_position);
-
- // Validate output
- validate(CLAccessor(dst), ref_dst);
-}
-BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * ConvertPolicies() * boost::unit_test::data::xrange(1, 15),
- shape, policy, fixed_point_position)
-{
- // Compute function
- CLTensor dst = compute_arithmetic_subtraction(shape, DataType::QS16, DataType::QS16, DataType::QS16, policy, fixed_point_position);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, DataType::QS16, DataType::QS16, DataType::QS16, policy, fixed_point_position);
-
- // Validate output
- validate(CLAccessor(dst), ref_dst);
-}
-BOOST_AUTO_TEST_SUITE_END()
-BOOST_AUTO_TEST_SUITE_END()
-
-BOOST_AUTO_TEST_SUITE(Float)
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP }),
- shape, policy)
-{
- // Create tensors
- CLTensor src1 = create_tensor<CLTensor>(shape, DataType::F32);
- CLTensor src2 = create_tensor<CLTensor>(shape, DataType::F32);
- CLTensor dst = create_tensor<CLTensor>(shape, DataType::F32);
-
- validate_configuration(src1, src2, dst, shape, policy);
-}
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
-BOOST_DATA_TEST_CASE(RunSmall, SmallShapes(), shape)
-{
- // Compute function
- CLTensor dst = compute_arithmetic_subtraction(shape, DataType::F32, DataType::F32, DataType::F32, ConvertPolicy::WRAP);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, DataType::F32, DataType::F32, DataType::F32, ConvertPolicy::WRAP);
-
- // Validate output
- validate(CLAccessor(dst), ref_dst);
-}
-BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP }),
- shape, policy)
-{
- // Compute function
- CLTensor dst = compute_arithmetic_subtraction(shape, DataType::F32, DataType::F32, DataType::F32, policy);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, DataType::F32, DataType::F32, DataType::F32, policy);
-
- // Validate output
- validate(CLAccessor(dst), ref_dst);
-}
-BOOST_AUTO_TEST_SUITE_END()
-
-BOOST_AUTO_TEST_SUITE_END()
-BOOST_AUTO_TEST_SUITE_END()
-#endif /* DOXYGEN_SKIP_THIS */
diff --git a/tests/validation_old/NEON/ArithmeticSubtraction.cpp b/tests/validation_old/NEON/ArithmeticSubtraction.cpp
deleted file mode 100644
index 86aa124f00..0000000000
--- a/tests/validation_old/NEON/ArithmeticSubtraction.cpp
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "NEON/Accessor.h"
-#include "PaddingCalculator.h"
-#include "TypePrinter.h"
-#include "Utils.h"
-#include "tests/AssetsLibrary.h"
-#include "tests/Globals.h"
-#include "tests/validation_old/Datasets.h"
-#include "tests/validation_old/Reference.h"
-#include "tests/validation_old/Validation.h"
-
-#include "arm_compute/core/Helpers.h"
-#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/NEON/functions/NEArithmeticSubtraction.h"
-#include "arm_compute/runtime/Tensor.h"
-#include "arm_compute/runtime/TensorAllocator.h"
-
-#include "tests/validation_old/boost_wrapper.h"
-
-#include <random>
-#include <string>
-
-using namespace arm_compute;
-using namespace arm_compute::test;
-using namespace arm_compute::test::validation;
-
-namespace
-{
-/** Compute Neon arithmetic subtraction function.
- *
- * @param[in] shape Shape of the input and output tensors.
- * @param[in] dt_in0 Data type of first input tensor.
- * @param[in] dt_in1 Data type of second input tensor.
- * @param[in] dt_out Data type of the output tensor.
- * @param[in] policy Overflow policy of the operation.
- * @param[in] fixed_point_position (Optional) Fixed point position that expresses the number of bits for the fractional part of the number when the tensor's data type is QS8 or QS16 (default = 0).
- *
- * @return Computed output tensor.
- */
-Tensor compute_arithmetic_subtraction(const TensorShape &shape, DataType dt_in0, DataType dt_in1, DataType dt_out, ConvertPolicy policy, int fixed_point_position = 0)
-{
- // Create tensors
- Tensor src1 = create_tensor<Tensor>(shape, dt_in0, 1, fixed_point_position);
- Tensor src2 = create_tensor<Tensor>(shape, dt_in1, 1, fixed_point_position);
- Tensor dst = create_tensor<Tensor>(shape, dt_out, 1, fixed_point_position);
-
- // Create and configure function
- NEArithmeticSubtraction sub;
- sub.configure(&src1, &src2, &dst, policy);
-
- // Allocate tensors
- src1.allocator()->allocate();
- src2.allocator()->allocate();
- dst.allocator()->allocate();
-
- BOOST_TEST(!src1.info()->is_resizable());
- BOOST_TEST(!src2.info()->is_resizable());
- BOOST_TEST(!dst.info()->is_resizable());
-
- // Fill tensors
- library->fill_tensor_uniform(Accessor(src1), 0);
- library->fill_tensor_uniform(Accessor(src2), 1);
-
- // Compute function
- sub.run();
-
- return dst;
-}
-
-void validate_configuration(const Tensor &src1, const Tensor &src2, Tensor &dst, TensorShape shape, ConvertPolicy policy)
-{
- BOOST_TEST(src1.info()->is_resizable());
- BOOST_TEST(src2.info()->is_resizable());
- BOOST_TEST(dst.info()->is_resizable());
-
- // Create and configure function
- NEArithmeticSubtraction sub;
- sub.configure(&src1, &src2, &dst, policy);
-
- // Validate valid region
- const ValidRegion valid_region = shape_to_valid_region(shape);
- validate(src1.info()->valid_region(), valid_region);
- validate(src2.info()->valid_region(), valid_region);
- validate(dst.info()->valid_region(), valid_region);
-
- // Validate padding
- const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding();
- validate(src1.info()->padding(), padding);
- validate(src2.info()->padding(), padding);
- validate(dst.info()->padding(), padding);
-}
-} // namespace
-
-#ifndef DOXYGEN_SKIP_THIS
-BOOST_AUTO_TEST_SUITE(NEON)
-BOOST_AUTO_TEST_SUITE(ArithmeticSubtraction)
-
-BOOST_AUTO_TEST_SUITE(U8)
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP }),
- shape, policy)
-{
- // Create tensors
- Tensor src1 = create_tensor<Tensor>(shape, DataType::U8);
- Tensor src2 = create_tensor<Tensor>(shape, DataType::U8);
- Tensor dst = create_tensor<Tensor>(shape, DataType::U8);
-
- validate_configuration(src1, src2, dst, shape, policy);
-}
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
-BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP }),
- shape, policy)
-{
- // Compute function
- Tensor dst = compute_arithmetic_subtraction(shape, DataType::U8, DataType::U8, DataType::U8, policy);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, DataType::U8, DataType::U8, DataType::U8, policy);
-
- // Validate output
- validate(Accessor(dst), ref_dst);
-}
-BOOST_AUTO_TEST_SUITE_END()
-
-BOOST_AUTO_TEST_SUITE(S16)
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ DataType::U8, DataType::S16 }) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP }),
- shape, dt, policy)
-{
- // Create tensors
- Tensor src1 = create_tensor<Tensor>(shape, dt);
- Tensor src2 = create_tensor<Tensor>(shape, DataType::S16);
- Tensor dst = create_tensor<Tensor>(shape, DataType::S16);
-
- validate_configuration(src1, src2, dst, shape, policy);
-}
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
-BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ DataType::U8, DataType::S16 }) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP }),
- shape, dt, policy)
-{
- // Compute function
- Tensor dst = compute_arithmetic_subtraction(shape, dt, DataType::S16, DataType::S16, policy);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, dt, DataType::S16, DataType::S16, policy);
-
- // Validate output
- validate(Accessor(dst), ref_dst);
-}
-BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ DataType::U8, DataType::S16 }) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP }),
- shape, dt, policy)
-{
- // Compute function
- Tensor dst = compute_arithmetic_subtraction(shape, dt, DataType::S16, DataType::S16, policy);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, dt, DataType::S16, DataType::S16, policy);
-
- // Validate output
- validate(Accessor(dst), ref_dst);
-}
-BOOST_AUTO_TEST_SUITE_END()
-
-BOOST_AUTO_TEST_SUITE(Quantized)
-BOOST_AUTO_TEST_SUITE(QS8)
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
-BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * ConvertPolicies() * boost::unit_test::data::xrange(1, 7),
- shape, policy, fixed_point_position)
-{
- // Compute function
- Tensor dst = compute_arithmetic_subtraction(shape, DataType::QS8, DataType::QS8, DataType::QS8, policy, fixed_point_position);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, DataType::QS8, DataType::QS8, DataType::QS8, policy, fixed_point_position);
-
- // Validate output
- validate(Accessor(dst), ref_dst);
-}
-
-BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * ConvertPolicies() * boost::unit_test::data::xrange(1, 7),
- shape, policy, fixed_point_position)
-{
- // Compute function
- Tensor dst = compute_arithmetic_subtraction(shape, DataType::QS8, DataType::QS8, DataType::QS8, policy, fixed_point_position);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, DataType::QS8, DataType::QS8, DataType::QS8, policy, fixed_point_position);
-
- // Validate output
- validate(Accessor(dst), ref_dst);
-}
-BOOST_AUTO_TEST_SUITE_END()
-
-BOOST_AUTO_TEST_SUITE(QS16)
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
-BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * ConvertPolicies() * boost::unit_test::data::xrange(1, 15),
- shape, policy, fixed_point_position)
-{
- // Compute function
- Tensor dst = compute_arithmetic_subtraction(shape, DataType::QS16, DataType::QS16, DataType::QS16, policy, fixed_point_position);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, DataType::QS16, DataType::QS16, DataType::QS16, policy, fixed_point_position);
-
- // Validate output
- validate(Accessor(dst), ref_dst);
-}
-BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * ConvertPolicies() * boost::unit_test::data::xrange(1, 15),
- shape, policy, fixed_point_position)
-{
- // Compute function
- Tensor dst = compute_arithmetic_subtraction(shape, DataType::QS16, DataType::QS16, DataType::QS16, policy, fixed_point_position);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, DataType::QS16, DataType::QS16, DataType::QS16, policy, fixed_point_position);
-
- // Validate output
- validate(Accessor(dst), ref_dst);
-}
-BOOST_AUTO_TEST_SUITE_END()
-BOOST_AUTO_TEST_SUITE_END()
-
-#ifdef ARM_COMPUTE_ENABLE_FP16
-BOOST_AUTO_TEST_SUITE(Float16)
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
-BOOST_DATA_TEST_CASE(RunSmall, SmallShapes(), shape)
-{
- // Compute function
- Tensor dst = compute_arithmetic_subtraction(shape, DataType::F16, DataType::F16, DataType::F16, ConvertPolicy::WRAP);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, DataType::F16, DataType::F16, DataType::F16, ConvertPolicy::WRAP);
-
- // Validate output
- validate(Accessor(dst), ref_dst);
-}
-BOOST_AUTO_TEST_SUITE_END()
-#endif /* ARM_COMPUTE_ENABLE_FP16 */
-
-BOOST_AUTO_TEST_SUITE(Float)
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP }),
- shape, policy)
-{
- // Create tensors
- Tensor src1 = create_tensor<Tensor>(shape, DataType::F32);
- Tensor src2 = create_tensor<Tensor>(shape, DataType::F32);
- Tensor dst = create_tensor<Tensor>(shape, DataType::F32);
-
- validate_configuration(src1, src2, dst, shape, policy);
-}
-BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
-BOOST_DATA_TEST_CASE(RunSmall, SmallShapes(), shape)
-{
- // Compute function
- Tensor dst = compute_arithmetic_subtraction(shape, DataType::F32, DataType::F32, DataType::F32, ConvertPolicy::WRAP);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, DataType::F32, DataType::F32, DataType::F32, ConvertPolicy::WRAP);
-
- // Validate output
- validate(Accessor(dst), ref_dst);
-}
-BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
-BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP }),
- shape, policy)
-{
- // Compute function
- Tensor dst = compute_arithmetic_subtraction(shape, DataType::F32, DataType::F32, DataType::F32, policy);
-
- // Compute reference
- RawTensor ref_dst = Reference::compute_reference_arithmetic_subtraction(shape, DataType::F32, DataType::F32, DataType::F32, policy);
-
- // Validate output
- validate(Accessor(dst), ref_dst);
-}
-BOOST_AUTO_TEST_SUITE_END()
-
-BOOST_AUTO_TEST_SUITE_END()
-BOOST_AUTO_TEST_SUITE_END()
-#endif /* DOXYGEN_SKIP_THIS */
diff --git a/tests/validation_old/Reference.cpp b/tests/validation_old/Reference.cpp
index f8f2ded1dc..5aa39cb22e 100644
--- a/tests/validation_old/Reference.cpp
+++ b/tests/validation_old/Reference.cpp
@@ -187,23 +187,6 @@ RawTensor Reference::compute_reference_accumulate_weighted(const TensorShape &sh
return ref_dst;
}
-RawTensor Reference::compute_reference_arithmetic_subtraction(const TensorShape &shape, DataType dt_in0, DataType dt_in1, DataType dt_out, ConvertPolicy convert_policy, int fixed_point_position)
-{
- // Create reference
- RawTensor ref_src1(shape, dt_in0, 1, fixed_point_position);
- RawTensor ref_src2(shape, dt_in1, 1, fixed_point_position);
- RawTensor ref_dst(shape, dt_out, 1, fixed_point_position);
-
- // Fill reference
- library->fill_tensor_uniform(ref_src1, 0);
- library->fill_tensor_uniform(ref_src2, 1);
-
- // Compute reference
- ReferenceCPP::arithmetic_subtraction(ref_src1, ref_src2, ref_dst, convert_policy);
-
- return ref_dst;
-}
-
RawTensor Reference::compute_reference_depth_convert(const TensorShape &shape, DataType dt_in, DataType dt_out, ConvertPolicy policy,
uint32_t shift, uint32_t fixed_point_position_in, uint32_t fixed_point_position_out)
{
diff --git a/tests/validation_old/Reference.h b/tests/validation_old/Reference.h
index 3be7de1b62..60383a4576 100644
--- a/tests/validation_old/Reference.h
+++ b/tests/validation_old/Reference.h
@@ -130,18 +130,6 @@ public:
* @return Computed raw tensor.
*/
static RawTensor compute_reference_accumulate_weighted(const TensorShape &shape, float alpha);
- /** Compute reference arithmetic subtraction.
- *
- * @param[in] shape Shape of the input and output tensors.
- * @param[in] dt_in0 Data type of first input tensor.
- * @param[in] dt_in1 Data type of second input tensor.
- * @param[in] dt_out Data type of the output tensor.
- * @param[in] convert_policy Overflow policy of the operation.
- * @param[in] fixed_point_position (Optional) Number of bits for the fractional part of the fixed point numbers
- *
- * @return Computed raw tensor.
- */
- static RawTensor compute_reference_arithmetic_subtraction(const TensorShape &shape, DataType dt_in0, DataType dt_in1, DataType dt_out, ConvertPolicy convert_policy, int fixed_point_position = 0);
/** Compute reference depth convert.
*
* @param[in] shape Shape of the input and output tensors.
diff --git a/tests/validation_old/ReferenceCPP.cpp b/tests/validation_old/ReferenceCPP.cpp
index 9c7ddf8579..0247b702ff 100644
--- a/tests/validation_old/ReferenceCPP.cpp
+++ b/tests/validation_old/ReferenceCPP.cpp
@@ -147,15 +147,6 @@ void ReferenceCPP::accumulate_weighted(const RawTensor &src, RawTensor &dst, flo
tensor_operations::accumulate_weighted(s, d, alpha);
}
-// Arithmetic subtraction
-void ReferenceCPP::arithmetic_subtraction(const RawTensor &src1, const RawTensor &src2, RawTensor &dst, ConvertPolicy convert_policy)
-{
- const TensorVariant s1 = TensorFactory::get_tensor(src1);
- const TensorVariant s2 = TensorFactory::get_tensor(src2);
- TensorVariant d = TensorFactory::get_tensor(dst);
- boost::apply_visitor(arithmetic_subtraction_visitor(convert_policy), s1, s2, d);
-}
-
// Depth conversion
void ReferenceCPP::depth_convert(const RawTensor &src, RawTensor &dst, ConvertPolicy policy, uint32_t shift)
{
diff --git a/tests/validation_old/ReferenceCPP.h b/tests/validation_old/ReferenceCPP.h
index 611e98a780..2ac1e5784b 100644
--- a/tests/validation_old/ReferenceCPP.h
+++ b/tests/validation_old/ReferenceCPP.h
@@ -127,14 +127,6 @@ public:
* @param[in] alpha A float value within the range of [0, 1]
*/
static void accumulate_weighted(const RawTensor &src, RawTensor &dst, float alpha);
- /** Arithmetic subtraction of @p src2 from @p src1
- *
- * @param[in] src1 First tensor.
- * @param[in] src2 Second tensor.
- * @param[out] dst Result tensor.
- * @param[in] convert_policy Overflow policy.
- */
- static void arithmetic_subtraction(const RawTensor &src1, const RawTensor &src2, RawTensor &dst, ConvertPolicy convert_policy);
/** Depth conversion from @p src to @p dst
*
* @param[in] src First tensor.
diff --git a/tests/validation_old/TensorOperations.h b/tests/validation_old/TensorOperations.h
index 7f29788fc7..79d3720b84 100644
--- a/tests/validation_old/TensorOperations.h
+++ b/tests/validation_old/TensorOperations.h
@@ -577,19 +577,6 @@ void accumulate_weighted(const Tensor<T> &in, Tensor<T> &out, float alpha)
}
}
-// Arithmetic Subtraction
-template <typename T1, typename T2, typename T3>
-void arithmetic_subtraction(const Tensor<T1> &in1, const Tensor<T2> &in2, Tensor<T3> &out, ConvertPolicy convert_policy)
-{
- using intermediate_type = typename common_promoted_signed_type<T1, T2, T3>::intermediate_type;
-
- for(int i = 0; i < in1.num_elements(); ++i)
- {
- intermediate_type val = static_cast<intermediate_type>(in1[i]) - static_cast<intermediate_type>(in2[i]);
- out[i] = (convert_policy == ConvertPolicy::SATURATE) ? saturate_cast<T3>(val) : static_cast<T3>(val);
- }
-}
-
// Depth conversion
template < typename T1, typename T2, typename std::enable_if < std::is_integral<T1>::value &&is_floating_point<T2>::value, int >::type = 0 >
void depth_convert(const Tensor<T1> &in, Tensor<T2> &out, ConvertPolicy policy, uint32_t shift)
diff --git a/tests/validation_old/TensorVisitors.h b/tests/validation_old/TensorVisitors.h
index 21ec11181d..ead7f389d5 100644
--- a/tests/validation_old/TensorVisitors.h
+++ b/tests/validation_old/TensorVisitors.h
@@ -78,24 +78,6 @@ public:
tensor_operations::absolute_difference(in1, in2, out);
}
};
-// Arithmetic Subtraction visitor
-struct arithmetic_subtraction_visitor : public boost::static_visitor<>
-{
-public:
- explicit arithmetic_subtraction_visitor(ConvertPolicy convert_policy)
- : _policy(convert_policy)
- {
- }
-
- template <typename T1, typename T2, typename T3>
- void operator()(const Tensor<T1> &in1, const Tensor<T2> &in2, Tensor<T3> &out) const
- {
- tensor_operations::arithmetic_subtraction(in1, in2, out, _policy);
- }
-
-private:
- ConvertPolicy _policy;
-};
// Depth Convert visitor
struct depth_convert_visitor : public boost::static_visitor<>
{