aboutsummaryrefslogtreecommitdiff
path: root/src/core/Utils.cpp
diff options
context:
space:
mode:
authorSang-Hoon Park <sang-hoon.park@arm.com>2020-01-08 16:02:47 +0000
committerMichele Di Giorgio <michele.digiorgio@arm.com>2020-01-14 14:26:14 +0000
commit4715cf9da26c4e914b9528f736e77d6773285169 (patch)
tree5143cfe1355e14dbc6d2314898c7a60601354277 /src/core/Utils.cpp
parent8ef5706e520c25b451f1923f34ea8b7e96aa0742 (diff)
downloadComputeLibrary-4715cf9da26c4e914b9528f736e77d6773285169.tar.gz
COMPMID-2760: add support for QASYMM8_SIGNED to CLGEMMConvolutionLayer
Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com> Change-Id: I55ab81d0f96c78af0396652cacf6640fc98ef3c2 Reviewed-on: https://review.mlplatform.org/c/2584 Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/Utils.cpp')
-rw-r--r--src/core/Utils.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core/Utils.cpp b/src/core/Utils.cpp
index 30e5b66540..f930804ce3 100644
--- a/src/core/Utils.cpp
+++ b/src/core/Utils.cpp
@@ -471,6 +471,21 @@ float arm_compute::calculate_resize_ratio(size_t input_size, size_t output_size,
return static_cast<float>(in) / static_cast<float>(out);
}
+std::pair<int32_t, int32_t> arm_compute::get_quantized_activation_min_max(ActivationLayerInfo act_info, DataType data_type, UniformQuantizationInfo oq_info)
+{
+ const bool is_qasymm8_signed = is_data_type_quantized_asymmetric_signed(data_type);
+ const auto a = act_info.a();
+ const auto b = act_info.b();
+ const int a_int = is_qasymm8_signed ? quantize_qasymm8_signed(a, oq_info) : quantize_qasymm8(a, oq_info);
+ const int b_int = is_qasymm8_signed ? quantize_qasymm8_signed(b, oq_info) : quantize_qasymm8(b, oq_info);
+ const auto type_max_value = std::get<1>(get_min_max(data_type)).get<int32_t>();
+
+ const int32_t min_activation = act_info.activation() != ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU ? oq_info.offset : b_int;
+ const int32_t max_activation = act_info.activation() == ActivationLayerInfo::ActivationFunction::RELU ? type_max_value : a_int;
+
+ return std::make_pair(min_activation, max_activation);
+}
+
#ifdef ARM_COMPUTE_ASSERTS_ENABLED
void arm_compute::print_consecutive_elements(std::ostream &s, DataType dt, const uint8_t *ptr, unsigned int n, int stream_width, const std::string &element_delim)
{