From 9c700378f2227cb9d51455ed4a5086daaac5532a Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Wed, 8 Jan 2020 11:33:44 +0000 Subject: COMPMID-2769: Add support for QASYMM8_SIGNED in NEFullyConnectedLayer Change-Id: I4c35c522375ae5a5de78716e079ebb9ffad15956 Signed-off-by: Michele Di Giorgio Reviewed-on: https://review.mlplatform.org/c/2581 Tested-by: Arm Jenkins Reviewed-by: Georgios Pinitas Comments-Addressed: Arm Jenkins --- tests/validation/reference/FullyConnectedLayer.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tests/validation/reference/FullyConnectedLayer.cpp') diff --git a/tests/validation/reference/FullyConnectedLayer.cpp b/tests/validation/reference/FullyConnectedLayer.cpp index 261c6453b9..9aecd6cf14 100644 --- a/tests/validation/reference/FullyConnectedLayer.cpp +++ b/tests/validation/reference/FullyConnectedLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -58,7 +58,7 @@ void vector_matrix_multiply(const SimpleTensor &src, const SimpleTensor &w } // Vector matrix multiply for quantized type -template < typename T, typename TB, typename std::enable_if < std::is_same::value &&std::is_same::value, int >::type = 0 > +template < typename T, typename TB, typename std::enable_if < (std::is_same::value || std::is_same::value) &&std::is_same::value, int >::type = 0 > void vector_matrix_multiply(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, SimpleTensor &dst, int offset_src, int offset_dst, int cols_weights, int rows_weights) { @@ -83,6 +83,9 @@ void vector_matrix_multiply(const SimpleTensor &src, const SimpleTensor &w const float multiplier = input_scale * weights_scale / output_scale; arm_compute::quantization::calculate_quantized_multiplier(multiplier, &output_multiplier, &output_shift); + const int min = std::numeric_limits::lowest(); + const int max = std::numeric_limits::max(); + for(int y = 0; y < rows_weights; ++y) { // Reset accumulator @@ -97,7 +100,7 @@ void vector_matrix_multiply(const SimpleTensor &src, const SimpleTensor &w acc += bias_ptr[y]; // Quantize down - acc = quantize_down_scale_by_fixedpoint(acc, output_multiplier, output_shift, output_offset, 0, 255); + acc = quantize_down_scale_by_fixedpoint(acc, output_multiplier, output_shift, output_offset, min, max); // Store the result dst_ptr[y] = static_cast(acc); @@ -160,6 +163,8 @@ template SimpleTensor fully_connected_layer(const SimpleTensor &src, QuantizationInfo out_quant_info); template SimpleTensor fully_connected_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &dst_shape, QuantizationInfo out_quant_info); +template SimpleTensor fully_connected_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &dst_shape, + QuantizationInfo out_quant_info); } // namespace reference } // namespace validation } // namespace test -- cgit v1.2.1