COMPMID-2763 [CL] add support for QASYMM8_SIGNED to SoftmaxLayer
Change-Id: I4556bde3aa51eb874a4e674dbbd575fa4491c088
Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com>
Reviewed-on: https://review.mlplatform.org/c/2375
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
diff --git a/src/core/Utils.cpp b/src/core/Utils.cpp
index fa56118..7e7dea5 100644
--- a/src/core/Utils.cpp
+++ b/src/core/Utils.cpp
@@ -438,6 +438,27 @@
return !is_first_dim || is_min_max || is_quantized_type;
}
+QuantizationInfo arm_compute::get_softmax_output_quantization_info(DataType input_type, bool is_log)
+{
+ // Note: Output quantization info for softmax should always have
+ // * Softmax with QASYMM8: scale = 1/256, offset = 0
+ // * Softmax with QASYMM8_SIGNED: scale = 1/256, offset = -128
+ // * LogSoftmax with QASYMM8: scale = 1/256, offset = 0
+ // * LogSoftmax with QASYMM8_SIGNED: scale = 16/256, offset = 127
+ if(is_data_type_quantized_asymmetric_signed(input_type))
+ {
+ if(is_log)
+ {
+ return QuantizationInfo(16.f / 256, 127);
+ }
+ else
+ {
+ return QuantizationInfo(1.f / 256, -128);
+ }
+ }
+ return QuantizationInfo(1.f / 256, 0);
+}
+
#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)
{