aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/CL/Scale.cpp
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2018-09-12 13:35:38 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:54:54 +0000
commit17220e2eb49e75b85f2b802489a44b8019997c25 (patch)
treecd2ab40769e866283c4d708de1d723b6f1150f66 /tests/validation/CL/Scale.cpp
parentf1addb665ad668dcd34e18c52e4961a7cf5e3886 (diff)
downloadComputeLibrary-17220e2eb49e75b85f2b802489a44b8019997c25.tar.gz
COMPMID-1507 Add support for QASYMM8 in CLScaleKernel
Change-Id: I4a32e47e6d9152633668cf0e14db88fc8c26f7ea Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/148167 Tested-by: bsgcomp <bsgcomp@arm.com> Reviewed-by: Michele DiGiorgio <michele.digiorgio@arm.com>
Diffstat (limited to 'tests/validation/CL/Scale.cpp')
-rw-r--r--tests/validation/CL/Scale.cpp61
1 files changed, 48 insertions, 13 deletions
diff --git a/tests/validation/CL/Scale.cpp b/tests/validation/CL/Scale.cpp
index 92d4f96c6a..3bf7c90a1e 100644
--- a/tests/validation/CL/Scale.cpp
+++ b/tests/validation/CL/Scale.cpp
@@ -78,7 +78,6 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
TensorInfo(TensorShape(36U, 36U, 2U, 4U), 1, DataType::U8),
TensorInfo(TensorShape(40U, 35U, 2U, 4U), 1, DataType::S16),
TensorInfo(TensorShape(37U, 37U, 2U), 1, DataType::F32), // window shrink
- TensorInfo(TensorShape(128U, 64U, 1U, 3U), 1, DataType::QASYMM8), // not supported
TensorInfo(TensorShape(37U, 37U, 3U, 4U), 1, DataType::F32), // mismatching datatype
TensorInfo(TensorShape(28U, 33U, 2U), 1, DataType::F32), // policy area, scale factor not correct
}),
@@ -87,7 +86,6 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
TensorInfo(TensorShape(40U, 76U, 2U, 4U), 1, DataType::U8),
TensorInfo(TensorShape(28U, 32U, 2U, 4U), 1, DataType::S16),
TensorInfo(TensorShape(39U, 55U, 2U), 1, DataType::F32), // window shrink
- TensorInfo(TensorShape(137U, 134U, 1U, 3U), 1, DataType::QASYMM8), // not supported
TensorInfo(TensorShape(39U, 77U, 3U, 4U), 1, DataType::F16), // mismatching datatype
TensorInfo(TensorShape(26U, 21U, 2U), 1, DataType::F32), // policy area, scale factor not correct
})),
@@ -97,7 +95,6 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
InterpolationPolicy::NEAREST_NEIGHBOR,
InterpolationPolicy::NEAREST_NEIGHBOR,
InterpolationPolicy::BILINEAR,
- InterpolationPolicy::BILINEAR,
InterpolationPolicy::AREA,
})),
framework::dataset::make("BorderMode",{ BorderMode::UNDEFINED,
@@ -107,9 +104,8 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
BorderMode::UNDEFINED,
BorderMode::UNDEFINED,
BorderMode::UNDEFINED,
- BorderMode::UNDEFINED,
})),
- framework::dataset::make("Expected", { true, true, true, true, false, false, false, false })),
+ framework::dataset::make("Expected", { true, true, true, true, false, false, false })),
input_info, output_info, policy, border_mode, expected)
{
Status status = CLScale::validate(&input_info.clone()->set_is_resizable(false),
@@ -197,7 +193,7 @@ FIXTURE_DATA_TEST_CASE(RunLarge, CLScaleFixture<float>, framework::DatasetMode::
// Validate output
validate(CLAccessor(_target), _reference, valid_region, tolerance_f32, tolerance_num_f32, tolerance_f32_absolute);
}
-TEST_SUITE_END()
+TEST_SUITE_END() // FP32
TEST_SUITE(FP16)
FIXTURE_DATA_TEST_CASE(RunSmall, CLScaleFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
DataType::F16)),
@@ -227,8 +223,8 @@ FIXTURE_DATA_TEST_CASE(RunLarge, CLScaleFixture<half>, framework::DatasetMode::N
// Validate output
validate(CLAccessor(_target), _reference, valid_region, tolerance_f16);
}
-TEST_SUITE_END()
-TEST_SUITE_END()
+TEST_SUITE_END() // FP16
+TEST_SUITE_END() // Float
TEST_SUITE(Integer)
TEST_SUITE(U8)
@@ -260,7 +256,7 @@ FIXTURE_DATA_TEST_CASE(RunLarge, CLScaleFixture<uint8_t>, framework::DatasetMode
// Validate output
validate(CLAccessor(_target), _reference, valid_region, tolerance_u8);
}
-TEST_SUITE_END()
+TEST_SUITE_END() // U8
TEST_SUITE(S16)
FIXTURE_DATA_TEST_CASE(RunSmall, CLScaleFixture<int16_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
DataType::S16)),
@@ -290,11 +286,50 @@ FIXTURE_DATA_TEST_CASE(RunLarge, CLScaleFixture<int16_t>, framework::DatasetMode
// Validate output
validate(CLAccessor(_target), _reference, valid_region, tolerance_s16);
}
-TEST_SUITE_END()
-TEST_SUITE_END()
+TEST_SUITE_END() // S16
+TEST_SUITE_END() // Integer
+
+template <typename T>
+using CLScaleQuantizedFixture = ScaleValidationQuantizedFixture<CLTensor, CLAccessor, CLScale, T>;
+TEST_SUITE(Quantized)
+TEST_SUITE(QASYMM8)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLScaleQuantizedFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine(datasets::SmallShapes(),
+ framework::dataset::make("DataType",
+ DataType::QASYMM8)),
+ framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, -1) })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
+ framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
+ datasets::BorderModes()),
+ datasets::SamplingPolicies()))
+{
+ //Create valid region
+ TensorInfo src_info(_shape, 1, _data_type);
+ const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _policy, _sampling_policy, (_border_mode == BorderMode::UNDEFINED));
+
+ // Validate output
+ validate(CLAccessor(_target), _reference, valid_region, tolerance_u8);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLScaleQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(combine(datasets::LargeShapes(),
+ framework::dataset::make("DataType",
+ DataType::QASYMM8)),
+ framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, -1) })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
+ framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
+ datasets::BorderModes()),
+ datasets::SamplingPolicies()))
+{
+ //Create valid region
+ TensorInfo src_info(_shape, 1, _data_type);
+ const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _policy, _sampling_policy, (_border_mode == BorderMode::UNDEFINED));
+
+ // Validate output
+ validate(CLAccessor(_target), _reference, valid_region, tolerance_u8);
+}
+TEST_SUITE_END() // QASYMM8
+TEST_SUITE_END() // Quantized
-TEST_SUITE_END()
-TEST_SUITE_END()
+TEST_SUITE_END() // Scale
+TEST_SUITE_END() // CL
} // namespace validation
} // namespace test
} // namespace arm_compute