From 7900a9efa421f0ac8faf9bb939f5c536b42c62b0 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Fri, 23 Nov 2018 11:44:58 +0000 Subject: COMPMID-1716: CL Comparison operations Adds support for Equal,NotEqual,Less,LessEqual,Greater,GreaterEqual Change-Id: If0cdf4aae7f95c94709b195eee485f6663f45909 --- tests/datasets/BorderModeDataset.h | 9 +- tests/datasets/ComparisonOperationsDataset.h | 57 ++++++++ tests/validation/CL/Comparisons.cpp | 180 ++++++++++++++++++++++++++ tests/validation/fixtures/ComparisonFixture.h | 152 ++++++++++++++++++++++ tests/validation/reference/Comparisons.cpp | 145 +++++++++++++++++++++ tests/validation/reference/Comparisons.h | 44 +++++++ 6 files changed, 579 insertions(+), 8 deletions(-) create mode 100644 tests/datasets/ComparisonOperationsDataset.h create mode 100644 tests/validation/CL/Comparisons.cpp create mode 100644 tests/validation/fixtures/ComparisonFixture.h create mode 100644 tests/validation/reference/Comparisons.cpp create mode 100644 tests/validation/reference/Comparisons.h (limited to 'tests') diff --git a/tests/datasets/BorderModeDataset.h b/tests/datasets/BorderModeDataset.h index 3b8a08ce61..78df2cc85f 100644 --- a/tests/datasets/BorderModeDataset.h +++ b/tests/datasets/BorderModeDataset.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -29,13 +29,6 @@ #include "utils/TypePrinter.h" -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include - namespace arm_compute { namespace test diff --git a/tests/datasets/ComparisonOperationsDataset.h b/tests/datasets/ComparisonOperationsDataset.h new file mode 100644 index 0000000000..ff70418eb3 --- /dev/null +++ b/tests/datasets/ComparisonOperationsDataset.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2018 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. + */ +#ifndef __ARM_COMPUTE_TEST_COMPARISON_OPERATIONS_DATASET_H__ +#define __ARM_COMPUTE_TEST_COMPARISON_OPERATIONS_DATASET_H__ + +#include "arm_compute/core/Types.h" +#include "tests/framework/datasets/ContainerDataset.h" + +#include "utils/TypePrinter.h" + +namespace arm_compute +{ +namespace test +{ +namespace datasets +{ +class ComparisonOperations final : public framework::dataset::ContainerDataset> +{ +public: + ComparisonOperations() + : ContainerDataset("ComparisonOperation", + { + ComparisonOperation::Equal, + ComparisonOperation::NotEqual, + ComparisonOperation::Greater, + ComparisonOperation::GreaterEqual, + ComparisonOperation::Less, + ComparisonOperation::LessEqual + }) + { + } +}; +} // namespace datasets +} // namespace test +} // namespace arm_compute +#endif /* __ARM_COMPUTE_TEST_COMPARISON_OPERATIONS_DATASET_H__ */ diff --git a/tests/validation/CL/Comparisons.cpp b/tests/validation/CL/Comparisons.cpp new file mode 100644 index 0000000000..790a8b5c9d --- /dev/null +++ b/tests/validation/CL/Comparisons.cpp @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2018 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 "arm_compute/core/Types.h" +#include "arm_compute/runtime/CL/CLTensor.h" +#include "arm_compute/runtime/CL/CLTensorAllocator.h" +#include "arm_compute/runtime/CL/functions/CLComparison.h" +#include "tests/CL/CLAccessor.h" +#include "tests/PaddingCalculator.h" +#include "tests/datasets/ComparisonOperationsDataset.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/ComparisonFixture.h" + +namespace arm_compute +{ +namespace test +{ +namespace validation +{ +namespace +{ +const auto configure_dataset = combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), + framework::dataset::make("DataType", { DataType::QASYMM8, DataType::F16, DataType::F32 })); + +const auto run_small_dataset = combine(datasets::ComparisonOperations(), datasets::SmallShapes()); +const auto run_large_dataset = combine(datasets::ComparisonOperations(), datasets::LargeShapes()); + +} // namespace + +TEST_SUITE(CL) +TEST_SUITE(Comparison) + +// *INDENT-OFF* +// clang-format off +DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( + framework::dataset::make("Input1Info", { TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Invalid output type + TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching input types + TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink + TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes + TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), + }), + 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::F32), + TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32), + TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), + })), + framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), + TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), + TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), + TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::U8), + TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), + })), + framework::dataset::make("Expected", { false, false, false, false, true})), + input1_info, input2_info, output_info, expected) +{ + Status s = CLComparison::validate(&input1_info.clone()->set_is_resizable(false), + &input2_info.clone()->set_is_resizable(false), + &output_info.clone()->set_is_resizable(false), + ComparisonOperation::Equal); + ARM_COMPUTE_EXPECT(bool(s) == expected, framework::LogLevel::ERRORS); +} +// clang-format on +// *INDENT-ON* + +DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, configure_dataset, + shape, data_type) +{ + // Create tensors + CLTensor ref_src1 = create_tensor(shape, data_type); + CLTensor ref_src2 = create_tensor(shape, data_type); + CLTensor dst = create_tensor(shape, DataType::U8); + + // Create and Configure function + CLComparison compare; + compare.configure(&ref_src1, &ref_src2, &dst, ComparisonOperation::Equal); + + // Validate valid region + const ValidRegion valid_region = shape_to_valid_region(shape); + validate(dst.info()->valid_region(), valid_region); + + const int num_elems_processed_per_iteration = 16 / ref_src1.info()->element_size(); + + // Validate padding + const PaddingSize padding = PaddingCalculator(shape.x(), num_elems_processed_per_iteration).required_padding(); + validate(ref_src1.info()->padding(), padding); + validate(ref_src2.info()->padding(), padding); + validate(dst.info()->padding(), padding); +} + +template +using CLComparisonFixture = ComparisonValidationFixture; + +TEST_SUITE(Float) +TEST_SUITE(FP16) +FIXTURE_DATA_TEST_CASE(RunSmall, + CLComparisonFixture, + framework::DatasetMode::PRECOMMIT, + combine(run_small_dataset, framework::dataset::make("DataType", DataType::F16))) +{ + // Validate output + validate(CLAccessor(_target), _reference); +} +FIXTURE_DATA_TEST_CASE(RunLarge, + CLComparisonFixture, + framework::DatasetMode::NIGHTLY, + combine(run_large_dataset, framework::dataset::make("DataType", DataType::F16))) +{ + // Validate output + validate(CLAccessor(_target), _reference); +} +TEST_SUITE_END() // FP16 + +TEST_SUITE(FP32) +FIXTURE_DATA_TEST_CASE(RunSmall, + CLComparisonFixture, + framework::DatasetMode::PRECOMMIT, + combine(run_small_dataset, framework::dataset::make("DataType", DataType::F32))) +{ + // Validate output + validate(CLAccessor(_target), _reference); +} +FIXTURE_DATA_TEST_CASE(RunLarge, + CLComparisonFixture, + framework::DatasetMode::NIGHTLY, + combine(run_large_dataset, framework::dataset::make("DataType", DataType::F32))) +{ + // Validate output + validate(CLAccessor(_target), _reference); +} +TEST_SUITE_END() // FP32 +TEST_SUITE_END() // Float + +template +using CLComparisonQuantizedFixture = ComparisonValidationQuantizedFixture; + +TEST_SUITE(Quantized) +TEST_SUITE(QASYMM8) +FIXTURE_DATA_TEST_CASE(RunSmall, + CLComparisonQuantizedFixture, + framework::DatasetMode::PRECOMMIT, + combine(combine(combine(run_small_dataset, framework::dataset::make("DataType", DataType::QASYMM8)), + framework::dataset::make("QuantizationInfo", { QuantizationInfo(5.f / 255.f, 20) })), + framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255.f, 10) }))) +{ + // Validate output + validate(CLAccessor(_target), _reference); +} +TEST_SUITE_END() +TEST_SUITE_END() + +TEST_SUITE_END() // Comparison +TEST_SUITE_END() // CL +} // namespace validation +} // namespace test +} // namespace arm_compute diff --git a/tests/validation/fixtures/ComparisonFixture.h b/tests/validation/fixtures/ComparisonFixture.h new file mode 100644 index 0000000000..b2fe42de26 --- /dev/null +++ b/tests/validation/fixtures/ComparisonFixture.h @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2018 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. + */ +#ifndef ARM_COMPUTE_TEST_COMPARISON_FIXTURE +#define ARM_COMPUTE_TEST_COMPARISON_FIXTURE + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/IAccessor.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/Helpers.h" +#include "tests/validation/reference/Comparisons.h" + +namespace arm_compute +{ +namespace test +{ +namespace validation +{ +template +class ComparisonValidationGenericFixture : public framework::Fixture +{ +public: + template + void setup(ComparisonOperation op, const TensorShape &shape0, const TensorShape &shape1, DataType data_type, QuantizationInfo qinfo0, QuantizationInfo qinfo1) + { + _target = compute_target(op, shape0, shape1, data_type, qinfo0, qinfo1); + _reference = compute_reference(op, shape0, shape1, data_type, qinfo0, qinfo1); + } + +protected: + template + void fill(U &&tensor, int i) + { + library->fill_tensor_uniform(tensor, i); + } + + TensorType compute_target(ComparisonOperation op, + const TensorShape &shape0, const TensorShape &shape1, DataType data_type, + QuantizationInfo qinfo0, QuantizationInfo qinfo1) + { + // Create tensors + TensorType ref_src1 = create_tensor(shape0, data_type, 1, qinfo0); + TensorType ref_src2 = create_tensor(shape1, data_type, 1, qinfo1); + TensorType dst = create_tensor(TensorShape::broadcast_shape(shape0, shape1), DataType::U8); + + // Create and configure function + FunctionType comp_op; + comp_op.configure(&ref_src1, &ref_src2, &dst, op); + + ARM_COMPUTE_EXPECT(ref_src1.info()->is_resizable(), framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(ref_src2.info()->is_resizable(), framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); + + // Allocate tensors + ref_src1.allocator()->allocate(); + ref_src2.allocator()->allocate(); + dst.allocator()->allocate(); + + ARM_COMPUTE_EXPECT(!ref_src1.info()->is_resizable(), framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(!ref_src2.info()->is_resizable(), framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); + + // Fill tensors + fill(AccessorType(ref_src1), 0); + fill(AccessorType(ref_src2), 1); + + // Compute function + comp_op.run(); + + return dst; + } + + SimpleTensor compute_reference(ComparisonOperation op, + const TensorShape &shape0, const TensorShape &shape1, DataType data_type, + QuantizationInfo qinfo0, QuantizationInfo qinfo1) + { + // Create reference + SimpleTensor ref_src1{ shape0, data_type, 1, qinfo0 }; + SimpleTensor ref_src2{ shape1, data_type, 1, qinfo1 }; + + // Fill reference + fill(ref_src1, 0); + fill(ref_src2, 1); + + return reference::compare(op, ref_src1, ref_src2); + } + + TensorType _target{}; + SimpleTensor _reference{}; +}; + +template +class ComparisonBroadcastValidationFixture : public ComparisonValidationGenericFixture +{ +public: + template + void setup(ComparisonOperation op, const TensorShape &shape0, const TensorShape &shape1, DataType data_type) + { + ComparisonValidationGenericFixture::setup(op, shape0, shape1, data_type, QuantizationInfo(), QuantizationInfo()); + } +}; + +template +class ComparisonValidationFixture : public ComparisonValidationGenericFixture +{ +public: + template + void setup(ComparisonOperation op, const TensorShape &shape, DataType data_type) + { + ComparisonValidationGenericFixture::setup(op, shape, shape, data_type, QuantizationInfo(), QuantizationInfo()); + } +}; + +template +class ComparisonValidationQuantizedFixture : public ComparisonValidationGenericFixture +{ +public: + template + void setup(ComparisonOperation op, const TensorShape &shape, DataType data_type, QuantizationInfo qinfo0, QuantizationInfo qinfo1) + + { + ComparisonValidationGenericFixture::setup(op, shape, shape, data_type, qinfo0, qinfo1); + } +}; +} // namespace validation +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_COMPARISON_FIXTURE */ diff --git a/tests/validation/reference/Comparisons.cpp b/tests/validation/reference/Comparisons.cpp new file mode 100644 index 0000000000..a83c365a22 --- /dev/null +++ b/tests/validation/reference/Comparisons.cpp @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2018 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 "Comparisons.h" + +#include "arm_compute/core/Types.h" +#include "tests/validation/Helpers.h" + +namespace arm_compute +{ +namespace test +{ +namespace validation +{ +namespace reference +{ +namespace +{ +template +uint8_t compare_op(ComparisonOperation op, T src1, T src2) +{ + uint8_t result = 0; + switch(op) + { + case ComparisonOperation::Equal: + result = static_cast(src1 == src2); + break; + case ComparisonOperation::NotEqual: + result = static_cast(src1 != src2); + break; + case ComparisonOperation::GreaterEqual: + result = static_cast(src1 >= src2); + break; + case ComparisonOperation::Greater: + result = static_cast(src1 > src2); + break; + case ComparisonOperation::LessEqual: + result = static_cast(src1 <= src2); + break; + case ComparisonOperation::Less: + result = static_cast(src1 < src2); + break; + default: + ARM_COMPUTE_ERROR("Unsupported operation"); + } + return (result != 0) ? 255 : 0; +} + +template +struct BroadcastUnroll +{ + template + static void unroll(ComparisonOperation op, + const SimpleTensor &src1, const SimpleTensor &src2, SimpleTensor &dst, + Coordinates &id_src1, Coordinates &id_src2, Coordinates &id_dst) + { + const bool src1_is_broadcast = (src1.shape()[dim - 1] != dst.shape()[dim - 1]); + const bool src2_is_broadcast = (src2.shape()[dim - 1] != dst.shape()[dim - 1]); + + id_src1.set(dim - 1, 0); + id_src2.set(dim - 1, 0); + id_dst.set(dim - 1, 0); + + for(size_t i = 0; i < dst.shape()[dim - 1]; ++i, ++id_dst[dim - 1]) + { + BroadcastUnroll < dim - 1 >::unroll(op, src1, src2, dst, id_src1, id_src2, id_dst); + + id_src1[dim - 1] += !src1_is_broadcast; + id_src2[dim - 1] += !src2_is_broadcast; + } + } +}; + +template <> +struct BroadcastUnroll<0> +{ + template + static void unroll(ComparisonOperation op, + const SimpleTensor &src1, const SimpleTensor &src2, SimpleTensor &dst, + Coordinates &id_src1, Coordinates &id_src2, Coordinates &id_dst) + { + dst[coord2index(dst.shape(), id_dst)] = compare_op(op, src1[coord2index(src1.shape(), id_src1)], src2[coord2index(src2.shape(), id_src2)]); + } +}; +} // namespace + +template +SimpleTensor compare(ComparisonOperation op, const SimpleTensor &src1, const SimpleTensor &src2) +{ + SimpleTensor dst(TensorShape::broadcast_shape(src1.shape(), src2.shape()), DataType::U8); + + Coordinates id_src1, id_src2, id_dst; + BroadcastUnroll::unroll(op, src1, src2, dst, id_src1, id_src2, id_dst); + return dst; +} + +template <> +SimpleTensor compare(ComparisonOperation op, const SimpleTensor &src1, const SimpleTensor &src2) +{ + SimpleTensor dst(TensorShape::broadcast_shape(src1.shape(), src2.shape()), DataType::U8); + + if(src1.data_type() == DataType::QASYMM8) + { + SimpleTensor src1_tmp = convert_from_asymmetric(src1); + SimpleTensor src2_tmp = convert_from_asymmetric(src2); + + Coordinates id_src1, id_src2, id_dst; + BroadcastUnroll::unroll(op, src1_tmp, src2_tmp, dst, id_src1, id_src2, id_dst); + } + else + { + // DataType::U8 + Coordinates id_src1, id_src2, id_dst; + BroadcastUnroll::unroll(op, src1, src2, dst, id_src1, id_src2, id_dst); + } + return dst; +} + +template SimpleTensor compare(ComparisonOperation op, const SimpleTensor &src1, const SimpleTensor &src2); +template SimpleTensor compare(ComparisonOperation op, const SimpleTensor &src1, const SimpleTensor &src2); + +} // namespace reference +} // namespace validation +} // namespace test +} // namespace arm_compute diff --git a/tests/validation/reference/Comparisons.h b/tests/validation/reference/Comparisons.h new file mode 100644 index 0000000000..4e054add32 --- /dev/null +++ b/tests/validation/reference/Comparisons.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018 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. + */ +#ifndef __ARM_COMPUTE_TEST_COMPARISONS_H__ +#define __ARM_COMPUTE_TEST_COMPARISONS_H__ + +#include "tests/SimpleTensor.h" +#include "tests/validation/Helpers.h" + +namespace arm_compute +{ +namespace test +{ +namespace validation +{ +namespace reference +{ +template +SimpleTensor compare(ComparisonOperation op, const SimpleTensor &src1, const SimpleTensor &src2); +} // namespace reference +} // namespace validation +} // namespace test +} // namespace arm_compute +#endif /* __ARM_COMPUTE_TEST_COMPARISONS_H__ */ -- cgit v1.2.1