aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/CL/ArithmeticSubtraction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/validation/CL/ArithmeticSubtraction.cpp')
-rw-r--r--tests/validation/CL/ArithmeticSubtraction.cpp83
1 files changed, 42 insertions, 41 deletions
diff --git a/tests/validation/CL/ArithmeticSubtraction.cpp b/tests/validation/CL/ArithmeticSubtraction.cpp
index cd13f42ec4..2cf410f373 100644
--- a/tests/validation/CL/ArithmeticSubtraction.cpp
+++ b/tests/validation/CL/ArithmeticSubtraction.cpp
@@ -24,7 +24,7 @@
#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/CLArithmeticSubtraction.h"
+#include "arm_compute/runtime/CL/functions/CLElementwiseOperations.h"
#include "tests/CL/CLAccessor.h"
#include "tests/PaddingCalculator.h"
#include "tests/datasets/ConvertPolicyDataset.h"
@@ -43,6 +43,7 @@ namespace validation
{
namespace
{
+constexpr unsigned int num_elems_processed_per_iteration = 16;
/** Input data sets **/
const auto ArithmeticSubtractionU8Dataset = combine(combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::U8)),
framework::dataset::make("DataType",
@@ -64,26 +65,26 @@ TEST_SUITE(ArithmeticSubtraction)
// *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::U8),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), // Window shrink
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
- }),
- framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
- TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
- })),
- framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
- TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
- })),
- framework::dataset::make("Expected", { true, true, false, false, false})),
- input1_info, input2_info, output_info, expected)
+ framework::dataset::make("Input1Info", { TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), // Window shrink
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
+ }),
+ framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
+ TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
+ })),
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
+ TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
+ })),
+ framework::dataset::make("Expected", { true, true, false, false, false})),
+ input1_info, input2_info, output_info, expected)
{
ARM_COMPUTE_EXPECT(bool(CLArithmeticSubtraction::validate(&input1_info.clone()->set_is_resizable(false), &input2_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), ConvertPolicy::WRAP)) == expected, framework::LogLevel::ERRORS);
}
@@ -103,15 +104,15 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::da
CLTensor dst = create_tensor<CLTensor>(shape, DataType::U8);
// Create and Configure function
- CLArithmeticSubtraction sub;
- sub.configure(&ref_src1, &ref_src2, &dst, policy);
+ CLArithmeticSubtraction add;
+ add.configure(&ref_src1, &ref_src2, &dst, policy);
// Validate valid region
const ValidRegion valid_region = shape_to_valid_region(shape);
validate(dst.info()->valid_region(), valid_region);
// Validate padding
- const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_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);
@@ -123,7 +124,7 @@ FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticSubtractionFixture<uint8_t>, framew
// Validate output
validate(CLAccessor(_target), _reference);
}
-TEST_SUITE_END() // U8
+TEST_SUITE_END()
template <typename T>
using CLArithmeticSubtractionQuantizedFixture = ArithmeticSubtractionValidationQuantizedFixture<CLTensor, CLAccessor, CLArithmeticSubtraction, T>;
@@ -147,7 +148,7 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::da
validate(dst.info()->valid_region(), valid_region);
// Validate padding
- const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_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);
@@ -165,8 +166,8 @@ FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticSubtractionQuantizedFixture<uint8_t
// Validate output
validate(CLAccessor(_target), _reference);
}
-TEST_SUITE_END() // QASYMM8
-TEST_SUITE_END() // Quantized
+TEST_SUITE_END()
+TEST_SUITE_END()
TEST_SUITE(S16)
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", { DataType::U8, DataType::S16 })),
@@ -179,15 +180,15 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(frame
CLTensor dst = create_tensor<CLTensor>(shape, DataType::S16);
// Create and Configure function
- CLArithmeticSubtraction sub;
- sub.configure(&ref_src1, &ref_src2, &dst, policy);
+ CLArithmeticSubtraction add;
+ add.configure(&ref_src1, &ref_src2, &dst, policy);
// Validate valid region
const ValidRegion valid_region = shape_to_valid_region(shape);
validate(dst.info()->valid_region(), valid_region);
// Validate padding
- const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_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);
@@ -206,7 +207,7 @@ FIXTURE_DATA_TEST_CASE(RunLarge, CLArithmeticSubtractionFixture<int16_t>, framew
// Validate output
validate(CLAccessor(_target), _reference);
}
-TEST_SUITE_END() // S16
+TEST_SUITE_END()
TEST_SUITE(Float)
TEST_SUITE(FP16)
@@ -216,7 +217,7 @@ FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticSubtractionFixture<half>, framework
// Validate output
validate(CLAccessor(_target), _reference);
}
-TEST_SUITE_END() // FP16
+TEST_SUITE_END()
TEST_SUITE(FP32)
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
@@ -228,15 +229,15 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::da
CLTensor dst = create_tensor<CLTensor>(shape, DataType::F32);
// Create and Configure function
- CLArithmeticSubtraction sub;
- sub.configure(&ref_src1, &ref_src2, &dst, policy);
+ CLArithmeticSubtraction add;
+ add.configure(&ref_src1, &ref_src2, &dst, policy);
// Validate valid region
const ValidRegion valid_region = shape_to_valid_region(shape);
validate(dst.info()->valid_region(), valid_region);
// Validate padding
- const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_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);
@@ -274,11 +275,11 @@ FIXTURE_DATA_TEST_CASE(RunLargeBroadcast, CLArithmeticSubtractionBroadcastFixtur
// Validate output
validate(CLAccessor(_target), _reference);
}
-TEST_SUITE_END() // FP32
-TEST_SUITE_END() // Float
+TEST_SUITE_END()
+TEST_SUITE_END()
-TEST_SUITE_END() // ArithmeticSubtraction
-TEST_SUITE_END() // CL
+TEST_SUITE_END()
+TEST_SUITE_END()
} // namespace validation
} // namespace test
-} // namespace arm_compute \ No newline at end of file
+} // namespace arm_compute