From 1c1b3aa470f3854000be22edb61991f6210e5605 Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Thu, 2 Apr 2020 17:35:42 +0100 Subject: COMPMID-3236: Implement CLQLSTMLayer COMPMID-3081: Extend CLQLSTMLayer with enhancements Change-Id: Idb7aaaacdba957e5ad61e94edeab2e898730a109 Signed-off-by: Michele Di Giorgio Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3057 Tested-by: Arm Jenkins Reviewed-by: Sang-Hoon Park Comments-Addressed: Arm Jenkins --- .../kernels/CLGEMMLowpMatrixMultiplyReshapedOnlyRHSKernel.cpp | 9 ++++++++- ...GEMMLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel.cpp | 6 +----- src/core/CL/kernels/CLGEMMLowpReductionKernel.cpp | 10 ++++++++-- 3 files changed, 17 insertions(+), 8 deletions(-) (limited to 'src/core/CL') diff --git a/src/core/CL/kernels/CLGEMMLowpMatrixMultiplyReshapedOnlyRHSKernel.cpp b/src/core/CL/kernels/CLGEMMLowpMatrixMultiplyReshapedOnlyRHSKernel.cpp index dd4c55c2d8..ad675df7ea 100644 --- a/src/core/CL/kernels/CLGEMMLowpMatrixMultiplyReshapedOnlyRHSKernel.cpp +++ b/src/core/CL/kernels/CLGEMMLowpMatrixMultiplyReshapedOnlyRHSKernel.cpp @@ -56,7 +56,14 @@ Status validate_arguments(const ITensorInfo *input0, const ITensorInfo *input1, { ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input0, input1, output); ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input0, 1, DataType::QASYMM8, DataType::QASYMM8_SIGNED); - ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input0, input1); + if(input0->data_type() == DataType::QASYMM8) + { + ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input0, input1); + } + else + { + ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input1, 1, DataType::QSYMM8, DataType::QASYMM8_SIGNED, DataType::QSYMM8_PER_CHANNEL); + } ARM_COMPUTE_RETURN_ERROR_ON_MSG(input0->num_dimensions() > 4, "The number of dimensions for the LHS matrix must be <= 4"); ARM_COMPUTE_RETURN_ERROR_ON_MSG(input1->num_dimensions() > 3, "The number of dimensions for the RHS matrix must be <= 3"); diff --git a/src/core/CL/kernels/CLGEMMLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel.cpp b/src/core/CL/kernels/CLGEMMLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel.cpp index 00cef56db7..066307c4b2 100644 --- a/src/core/CL/kernels/CLGEMMLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel.cpp +++ b/src/core/CL/kernels/CLGEMMLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel.cpp @@ -35,8 +35,6 @@ #include "support/StringSupport.h" -using namespace arm_compute; - namespace arm_compute { namespace @@ -98,9 +96,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen } } // namespace -class Coordinates; -} // namespace arm_compute - CLGEMMLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel::CLGEMMLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel() : _input(nullptr), _bias(nullptr), _output(nullptr) { @@ -184,3 +179,4 @@ void CLGEMMLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel::run(const Window } while(collapsed.slide_window_slice_3D(slice)); } +} // namespace arm_compute diff --git a/src/core/CL/kernels/CLGEMMLowpReductionKernel.cpp b/src/core/CL/kernels/CLGEMMLowpReductionKernel.cpp index e81ab2ffba..9fa253a55a 100644 --- a/src/core/CL/kernels/CLGEMMLowpReductionKernel.cpp +++ b/src/core/CL/kernels/CLGEMMLowpReductionKernel.cpp @@ -36,7 +36,7 @@ namespace Status validate_arguments_matrix_a_reduction(const ITensorInfo *input, const ITensorInfo *output) { ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output); - ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QASYMM8, DataType::QASYMM8_SIGNED); + ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QASYMM8, DataType::QASYMM8_SIGNED, DataType::QSYMM8); if(output->total_size() > 0) { @@ -49,7 +49,7 @@ Status validate_arguments_matrix_a_reduction(const ITensorInfo *input, const ITe Status validate_arguments_matrix_b_reduction(const ITensorInfo *input, const ITensorInfo *output) { ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output); - ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QASYMM8, DataType::QASYMM8_SIGNED); + ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QASYMM8, DataType::QASYMM8_SIGNED, DataType::QSYMM8); if(output->total_size() > 0) { @@ -63,6 +63,9 @@ std::pair validate_and_configure_window_matrix_b_reduction(ITens { constexpr unsigned int num_elems_processed_per_iteration = 16; + // Output auto initialization if not yet initialized + auto_init_if_empty(*output, TensorShape(input->dimension(0)), 1, DataType::S32); + // Configure kernel window Window win = calculate_max_window(*output, Steps(num_elems_processed_per_iteration)); @@ -94,6 +97,9 @@ void CLGEMMLowpMatrixAReductionKernel::configure(CLCompileContext &compile_conte ARM_COMPUTE_ERROR_ON_NULLPTR(mtx_a, vector_sum_row); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments_matrix_a_reduction(mtx_a->info(), vector_sum_row->info())); + // Output auto initialization if not yet initialized + auto_init_if_empty(*vector_sum_row->info(), TensorShape(mtx_a->info()->dimension(1)), 1, DataType::S32); + _input = mtx_a; _output = vector_sum_row; -- cgit v1.2.1