-
Notifications
You must be signed in to change notification settings - Fork 814
fix: Enable asm requantized max pooling with differing qinfo #1285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,6 +115,28 @@ const auto PoolingDatasetQASYMM8PaddedMax = combine(make("Shape", {TensorShape(7 | |
| make("InputQuantInfo", {QuantizationInfo(0.25f, 11)}), | ||
| make("OutputQuantInfo", {QuantizationInfo(0.25f, 11)})); | ||
|
|
||
| const auto PoolingDatasetQASYMM8SignedPaddedMaxDifferentQInfoZeroOffset = | ||
| combine(make("Shape", {TensorShape(7U, 5U, 3U), TensorShape(8U, 7U, 5U)}), | ||
| make("PoolingType", {PoolingType::MAX}), | ||
| make("PoolingSize", {Size2D(3, 3)}), | ||
| make("PadStride", {PadStrideInfo(2, 2, 1, 1)}), | ||
| make("ExcludePadding", {false}), | ||
| make("DataType", DataType::QASYMM8_SIGNED), | ||
| make("DataLayout", {DataLayout::NHWC}), | ||
| make("InputQuantInfo", {QuantizationInfo(0.25f, 0)}), | ||
| make("OutputQuantInfo", {QuantizationInfo(0.5f, 0)})); | ||
|
|
||
| const auto PoolingDatasetQASYMM8SignedPaddedMaxSameQInfo = | ||
| combine(make("Shape", {TensorShape(7U, 5U, 3U), TensorShape(8U, 7U, 5U)}), | ||
| make("PoolingType", {PoolingType::MAX}), | ||
| make("PoolingSize", {Size2D(3, 3)}), | ||
| make("PadStride", {PadStrideInfo(2, 2, 1, 1)}), | ||
| make("ExcludePadding", {false}), | ||
| make("DataType", DataType::QASYMM8_SIGNED), | ||
| make("DataLayout", {DataLayout::NHWC}), | ||
| make("InputQuantInfo", {QuantizationInfo(0.25f, -11)}), | ||
| make("OutputQuantInfo", {QuantizationInfo(0.25f, -11)})); | ||
|
|
||
| TEST_SUITE(NEON) | ||
| TEST_SUITE(PoolingLayer) | ||
|
|
||
|
|
@@ -163,12 +185,44 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip( | |
| ), | ||
| input_info, output_info, pool_info, expected) | ||
| { | ||
| bool is_valid = bool(NEPoolingLayer::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), pool_info)); | ||
| bool is_valid = bool(NEPoolingLayer::validate(&input_info.clone()->set_is_resizable(false), | ||
| &output_info.clone()->set_is_resizable(false), | ||
| pool_info)); | ||
| ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS); | ||
|
gunes-arm marked this conversation as resolved.
|
||
| } | ||
| // clang-format on | ||
| // *INDENT-ON* | ||
|
|
||
| TEST_CASE(ValidatePaddedMaxDifferentQuantizationInfo, framework::DatasetMode::ALL) | ||
| { | ||
| TensorInfo input_info(TensorShape(3U, 15U, 11U, 1U), 1, DataType::QASYMM8, DataLayout::NHWC); | ||
| TensorInfo output_info(TensorShape(3U, 8U, 6U, 1U), 1, DataType::QASYMM8, DataLayout::NHWC); | ||
| const auto pool_info = PoolingLayerInfo(PoolingType::MAX, 3, DataLayout::NHWC, PadStrideInfo(2, 2, 1, 1), false); | ||
|
|
||
| input_info.set_quantization_info(QuantizationInfo(0.25f, 11)); | ||
| output_info.set_quantization_info(QuantizationInfo(0.5f, 7)); | ||
|
|
||
| const bool is_valid = bool(NEPoolingLayer::validate(&input_info.clone()->set_is_resizable(false), | ||
| &output_info.clone()->set_is_resizable(false), pool_info)); | ||
|
|
||
| ARM_COMPUTE_EXPECT(is_valid, framework::LogLevel::ERRORS); | ||
| } | ||
|
|
||
| TEST_CASE(ValidatePaddedAvgDifferentQuantizationInfo, framework::DatasetMode::ALL) | ||
| { | ||
| TensorInfo input_info(TensorShape(3U, 15U, 11U, 1U), 1, DataType::QASYMM8, DataLayout::NHWC); | ||
| TensorInfo output_info(TensorShape(3U, 8U, 6U, 1U), 1, DataType::QASYMM8, DataLayout::NHWC); | ||
| const auto pool_info = PoolingLayerInfo(PoolingType::AVG, 3, DataLayout::NHWC, PadStrideInfo(2, 2, 1, 1), false); | ||
|
|
||
| input_info.set_quantization_info(QuantizationInfo(0.25f, 11)); | ||
| output_info.set_quantization_info(QuantizationInfo(0.5f, 7)); | ||
|
|
||
| const bool is_valid = bool(NEPoolingLayer::validate(&input_info.clone()->set_is_resizable(false), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think you need to clone here. It was for constant objects as far as I recall. |
||
| &output_info.clone()->set_is_resizable(false), pool_info)); | ||
|
|
||
| ARM_COMPUTE_EXPECT(!is_valid, framework::LogLevel::ERRORS); | ||
| } | ||
|
|
||
| template <typename T> | ||
| using NEPoolingLayerIndicesFixture = PoolingLayerIndicesValidationFixture<Tensor, Accessor, NEPoolingLayer, T>; | ||
|
|
||
|
|
@@ -448,6 +502,22 @@ FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, | |
| } | ||
| TEST_SUITE_END() // QASYMM8 | ||
| TEST_SUITE(QASYMM8_SIGNED) | ||
| FIXTURE_DATA_TEST_CASE(PaddedMaxSameQInfo, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add QASYMM8 tests, too? They use different underlying kernels. Probably, we need to put arbitrary quantization infos to src and dst as they don't have to be 0 offset. |
||
| NEPoolingLayerQuantizedFixture<int8_t>, | ||
| framework::DatasetMode::PRECOMMIT, | ||
| PoolingDatasetQASYMM8SignedPaddedMaxSameQInfo) | ||
| { | ||
| // Validate output | ||
| validate(Accessor(_target), _reference, tolerance_qasymm8_s); | ||
| } | ||
| FIXTURE_DATA_TEST_CASE(PaddedMaxDifferentQInfoZeroOffset, | ||
| NEPoolingLayerQuantizedFixture<int8_t>, | ||
| framework::DatasetMode::PRECOMMIT, | ||
| PoolingDatasetQASYMM8SignedPaddedMaxDifferentQInfoZeroOffset) | ||
| { | ||
| // Validate output | ||
| validate(Accessor(_target), _reference, tolerance_qasymm8_s); | ||
| } | ||
| FIXTURE_DATA_TEST_CASE(RunSmall, | ||
| NEPoolingLayerQuantizedFixture<int8_t>, | ||
| framework::DatasetMode::PRECOMMIT, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.