From eaa01ab593428bc7267ebbe107b2d813a11b64b5 Mon Sep 17 00:00:00 2001 From: Sang-Hoon Park Date: Mon, 11 Nov 2019 17:33:28 +0000 Subject: COMPMID-2671 use Signed32 for default output data type of ArgMinMax Signed32 is used as data types before and after reshaping of ArgMinMax. Change-Id: I230af43a931d4e106de6c72f716ced1dab511084 Signed-off-by: Sang-Hoon Park Reviewed-on: https://review.mlplatform.org/c/2262 Comments-Addressed: Arm Jenkins Reviewed-by: Michele Di Giorgio Tested-by: Arm Jenkins Reviewed-by: Giorgio Arena --- src/core/CL/kernels/CLReductionOperationKernel.cpp | 2 +- src/core/NEON/kernels/NEReductionOperationKernel.cpp | 2 +- src/runtime/CL/functions/CLReductionOperation.cpp | 6 +++--- src/runtime/NEON/functions/NEReductionOperation.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/core/CL/kernels/CLReductionOperationKernel.cpp b/src/core/CL/kernels/CLReductionOperationKernel.cpp index a085ab1683..cbf3923243 100644 --- a/src/core/CL/kernels/CLReductionOperationKernel.cpp +++ b/src/core/CL/kernels/CLReductionOperationKernel.cpp @@ -83,7 +83,7 @@ std::tuple validate_and_configure_window(ITensorInfo *input, ITe // Output tensor auto initialization if not yet initialized const bool is_arg_min_max = (op == ReductionOperation::ARG_IDX_MIN || op == ReductionOperation::ARG_IDX_MAX); const TensorShape output_shape = arm_compute::misc::shape_calculator::compute_reduced_shape(input->tensor_shape(), axis, !is_arg_min_max); - const DataType output_data_type = is_arg_min_max ? DataType::U32 : input->data_type(); + const DataType output_data_type = is_arg_min_max ? DataType::S32 : input->data_type(); auto_init_if_empty(*output, input->clone()->set_tensor_shape(output_shape).set_data_type(output_data_type).reset_padding().set_is_resizable(true)); const unsigned int num_elems_processed_per_iteration = (is_data_type_quantized(input->data_type()) && (axis == 0)) ? 1 : 16; diff --git a/src/core/NEON/kernels/NEReductionOperationKernel.cpp b/src/core/NEON/kernels/NEReductionOperationKernel.cpp index 85abda598d..a2ce0de38b 100644 --- a/src/core/NEON/kernels/NEReductionOperationKernel.cpp +++ b/src/core/NEON/kernels/NEReductionOperationKernel.cpp @@ -1204,7 +1204,7 @@ std::tuple validate_and_configure_window(ITensorInfo *input, ITe // Output auto initialization if not yet initialized const bool is_arg_min_max = (op == ReductionOperation::ARG_IDX_MIN || op == ReductionOperation::ARG_IDX_MAX); - DataType output_data_type = is_arg_min_max ? DataType::U32 : input->data_type(); + DataType output_data_type = is_arg_min_max ? DataType::S32 : input->data_type(); auto_init_if_empty(*output, input->clone()->set_tensor_shape(output_shape).set_data_type(output_data_type).reset_padding().set_is_resizable(true)); unsigned int num_elems_processed_per_iteration = 16 / data_size_from_type(input->data_type()); diff --git a/src/runtime/CL/functions/CLReductionOperation.cpp b/src/runtime/CL/functions/CLReductionOperation.cpp index 447c15b1e8..3aa5a813b6 100644 --- a/src/runtime/CL/functions/CLReductionOperation.cpp +++ b/src/runtime/CL/functions/CLReductionOperation.cpp @@ -86,7 +86,7 @@ Status CLReductionOperation::validate(const ITensorInfo *input, const ITensorInf const auto input_data_type = input->data_type(); const auto input_num_channles = input->num_channels(); const auto input_qinfo = input->quantization_info(); - const auto output_data_type = is_arg_min_max ? DataType::U32 : output->data_type(); + const auto output_data_type = is_arg_min_max ? DataType::S32 : output->data_type(); auto initialize_tensorinfo = [](TensorInfo & ti, TensorShape shape, DataType data_type, int num_channels, QuantizationInfo qinfo) { @@ -208,7 +208,7 @@ ICLTensor *CLReductionOperation::configure_intermediate_result_vector(ICLTensor if(is_arg_min_max) { - _results_vector.back().info()->set_data_type(DataType::U32).set_is_resizable(true).reset_padding(); + _results_vector.back().info()->set_data_type(DataType::S32).set_is_resizable(true).reset_padding(); } return _is_reshape_required ? &_results_vector.back() : output; @@ -229,7 +229,7 @@ void CLReductionOperation::configure(ICLTensor *input, ICLTensor *output, unsign if(_is_reshape_required) { const TensorShape output_shape = arm_compute::misc::shape_calculator::compute_reduced_shape(input->info()->tensor_shape(), axis, false); - const auto output_data_type = is_arg_min_max ? DataType::U32 : input->info()->data_type(); + const auto output_data_type = is_arg_min_max ? DataType::S32 : input->info()->data_type(); auto_init_if_empty(*output->info(), input->info()->clone()->set_tensor_shape(output_shape).set_data_type(output_data_type).reset_padding().set_is_resizable(true)); } diff --git a/src/runtime/NEON/functions/NEReductionOperation.cpp b/src/runtime/NEON/functions/NEReductionOperation.cpp index 09cd765d4b..397fe21cb9 100644 --- a/src/runtime/NEON/functions/NEReductionOperation.cpp +++ b/src/runtime/NEON/functions/NEReductionOperation.cpp @@ -80,7 +80,7 @@ Status NEReductionOperation::validate(const ITensorInfo *input, const ITensorInf const auto input_num_channles = input->num_channels(); const auto input_qinfo = input->quantization_info(); const auto is_arg_min_max = (op == ReductionOperation::ARG_IDX_MAX) || (op == ReductionOperation::ARG_IDX_MIN); - const auto output_data_type = is_arg_min_max ? DataType::U32 : output->data_type(); + const auto output_data_type = is_arg_min_max ? DataType::S32 : output->data_type(); info_before_reshape.set_data_type(output_data_type).set_tensor_shape(shape_before_reshape).set_num_channels(input_num_channles).set_quantization_info(input_qinfo); @@ -110,7 +110,7 @@ void NEReductionOperation::configure(ITensor *input, ITensor *output, unsigned i { const auto output_internal_shape = arm_compute::misc::shape_calculator::compute_reduced_shape(input->info()->tensor_shape(), axis); const auto output_external_shape = arm_compute::misc::shape_calculator::compute_reduced_shape(input->info()->tensor_shape(), axis, false); - const auto output_data_type = is_arg_min_max ? DataType::U32 : input->info()->data_type(); + const auto output_data_type = is_arg_min_max ? DataType::S32 : input->info()->data_type(); const auto num_channels = input->info()->num_channels(); const auto qinfo = input->info()->quantization_info(); -- cgit v1.2.1