aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSheri Zhang <sheri.zhang@arm.com>2020-03-16 21:25:52 +0000
committerSheri Zhang <sheri.zhang@arm.com>2020-03-23 11:23:18 +0000
commitd9a623a1729a9a613f7dcf8cf8536e5d8dd921b4 (patch)
tree315525f3c90dc0111edeb6cc8015c67f2b7813e7
parent970353e3e9ee402ab7294230654b5b9151cd57f3 (diff)
downloadComputeLibrary-d9a623a1729a9a613f7dcf8cf8536e5d8dd921b4.tar.gz
COMPMID-3274: Add support for QASYMM8_SIGNED in CPPBoxWithNonMaximaSuppressionLimit
Signed-off-by: Sheri Zhang <sheri.zhang@arm.com> Change-Id: I2b95dbf97eb852d9cd72710d79a40de82ea37595 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/2894 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--arm_compute/runtime/CPP/functions/CPPBoxWithNonMaximaSuppressionLimit.h14
-rw-r--r--src/runtime/CPP/functions/CPPBoxWithNonMaximaSuppressionLimit.cpp22
2 files changed, 25 insertions, 11 deletions
diff --git a/arm_compute/runtime/CPP/functions/CPPBoxWithNonMaximaSuppressionLimit.h b/arm_compute/runtime/CPP/functions/CPPBoxWithNonMaximaSuppressionLimit.h
index 171f5e63b6..b6f55b5bf8 100644
--- a/arm_compute/runtime/CPP/functions/CPPBoxWithNonMaximaSuppressionLimit.h
+++ b/arm_compute/runtime/CPP/functions/CPPBoxWithNonMaximaSuppressionLimit.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019 ARM Limited.
+ * Copyright (c) 2018-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -47,14 +47,14 @@ public:
CPPBoxWithNonMaximaSuppressionLimit &operator=(const CPPBoxWithNonMaximaSuppressionLimit &) = delete;
/** Configure the BoxWithNonMaximaSuppressionLimit CPP kernel
*
- * @param[in] scores_in The scores input tensor of size [count, num_classes]. Data types supported: QASYMM8/F16/F32
+ * @param[in] scores_in The scores input tensor of size [count, num_classes]. Data types supported: QASYMM8/QASYMM8_SIGNED/F16/F32
* @param[in] boxes_in The boxes input tensor of size [count, num_classes * 4].
- * Data types supported: QASYMM16 with 0.125 scale and 0 offset if @p scores_in is QASYMM8, otherwise same as @p scores_in
+ * Data types supported: QASYMM16 with 0.125 scale and 0 offset if @p scores_in is QASYMM8/QASYMM8_SIGNED, otherwise same as @p scores_in
* @param[in] batch_splits_in The batch splits input tensor of size [batch_size]. Data types supported: Same as @p scores_in
* @note Can be a nullptr. If not a nullptr, @p scores_in and @p boxes_in have items from multiple images.
* @param[out] scores_out The scores output tensor of size [N]. Data types supported: Same as @p scores_in
* @param[out] boxes_out The boxes output tensor of size [N, 4].
- * Data types supported: QASYMM16 with 0.125 scale and 0 offset if @p scores_in is QASYMM8, otherwise same as @p scores_in
+ * Data types supported: QASYMM16 with 0.125 scale and 0 offset if @p scores_in is QASYMM8/QASYMM8_SIGNED, otherwise same as @p scores_in
* @param[out] classes The classes output tensor of size [N]. Data types supported: Same as @p scores_in
* @param[out] batch_splits_out (Optional) The batch splits output tensor. Data types supported: Same as @p scores_in
* @param[out] keeps (Optional) The keeps output tensor of size [N]. Data types supported: Same as @p scores_in
@@ -65,14 +65,14 @@ public:
ITensor *batch_splits_out = nullptr, ITensor *keeps = nullptr, ITensor *keeps_size = nullptr, const BoxNMSLimitInfo info = BoxNMSLimitInfo());
/** Static function to check if given info will lead to a valid configuration of @ref CPPDetectionOutputLayer
*
- * @param[in] scores_in The scores input tensor of size [count, num_classes]. Data types supported: QASYMM8/F16/F32
+ * @param[in] scores_in The scores input tensor of size [count, num_classes]. Data types supported: QASYMM8/QASYMM8_SIGNED/F16/F32
* @param[in] boxes_in The boxes input tensor of size [count, num_classes * 4].
- * Data types supported: QASYMM16 with 0.125 scale and 0 offset if @p scores_in is QASYMM8, otherwise same as @p scores_in
+ * Data types supported: QASYMM16 with 0.125 scale and 0 offset if @p scores_in is QASYMM8/QASYMM8_SIGNED, otherwise same as @p scores_in
* @param[in] batch_splits_in The batch splits input tensor of size [batch_size]. Data types supported: Same as @p scores_in
* @note Can be a nullptr. If not a nullptr, @p scores_in and @p boxes_in have items from multiple images.
* @param[in] scores_out The scores output tensor of size [N]. Data types supported: Same as @p scores_in
* @param[in] boxes_out The boxes output tensor of size [N, 4].
- * Data types supported: QASYMM16 with 0.125 scale and 0 offset if @p scores_in is QASYMM8, otherwise same as @p scores_in
+ * Data types supported: QASYMM16 with 0.125 scale and 0 offset if @p scores_in is QASYMM8/QASYMM8_SIGNED, otherwise same as @p scores_in
* @param[in] classes The classes output tensor of size [N]. Data types supported: Same as @p scores_in
* @param[in] batch_splits_out (Optional) The batch splits output tensor. Data types supported: Same as @p scores_in
* @param[in] keeps (Optional) The keeps output tensor of size [N]. Data types supported: Same as @p scores_in
diff --git a/src/runtime/CPP/functions/CPPBoxWithNonMaximaSuppressionLimit.cpp b/src/runtime/CPP/functions/CPPBoxWithNonMaximaSuppressionLimit.cpp
index d4be939c52..232f71dbea 100644
--- a/src/runtime/CPP/functions/CPPBoxWithNonMaximaSuppressionLimit.cpp
+++ b/src/runtime/CPP/functions/CPPBoxWithNonMaximaSuppressionLimit.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019 ARM Limited.
+ * Copyright (c) 2018-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -49,6 +49,13 @@ void dequantize_tensor(const ITensor *input, ITensor *output)
},
input_it, output_it);
break;
+ case DataType::QASYMM8_SIGNED:
+ execute_window_loop(window, [&](const Coordinates &)
+ {
+ *reinterpret_cast<float *>(output_it.ptr()) = dequantize_qasymm8_signed(*reinterpret_cast<const int8_t *>(input_it.ptr()), qinfo);
+ },
+ input_it, output_it);
+ break;
case DataType::QASYMM16:
execute_window_loop(window, [&](const Coordinates &)
{
@@ -80,6 +87,13 @@ void quantize_tensor(const ITensor *input, ITensor *output)
},
input_it, output_it);
break;
+ case DataType::QASYMM8_SIGNED:
+ execute_window_loop(window, [&](const Coordinates &)
+ {
+ *reinterpret_cast<int8_t *>(output_it.ptr()) = quantize_qasymm8_signed(*reinterpret_cast<const float *>(input_it.ptr()), qinfo);
+ },
+ input_it, output_it);
+ break;
case DataType::QASYMM16:
execute_window_loop(window, [&](const Coordinates &)
{
@@ -121,7 +135,7 @@ void CPPBoxWithNonMaximaSuppressionLimit::configure(const ITensor *scores_in, co
{
ARM_COMPUTE_ERROR_ON_NULLPTR(scores_in, boxes_in, scores_out, boxes_out, classes);
- _is_qasymm8 = scores_in->info()->data_type() == DataType::QASYMM8;
+ _is_qasymm8 = scores_in->info()->data_type() == DataType::QASYMM8 || scores_in->info()->data_type() == DataType::QASYMM8_SIGNED;
_scores_in = scores_in;
_boxes_in = boxes_in;
@@ -198,9 +212,9 @@ Status validate(const ITensorInfo *scores_in, const ITensorInfo *boxes_in, const
{
ARM_COMPUTE_UNUSED(batch_splits_in, batch_splits_out, keeps, keeps_size, info);
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(scores_in, boxes_in, scores_out, boxes_out, classes);
- ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(scores_in, 1, DataType::QASYMM8, DataType::F16, DataType::F32);
+ ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(scores_in, 1, DataType::QASYMM8, DataType::QASYMM8_SIGNED, DataType::F16, DataType::F32);
- const bool is_qasymm8 = scores_in->data_type() == DataType::QASYMM8;
+ const bool is_qasymm8 = scores_in->data_type() == DataType::QASYMM8 || scores_in->data_type() == DataType::QASYMM8_SIGNED;
if(is_qasymm8)
{
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(boxes_in, 1, DataType::QASYMM16);