From 1bae0f9c66c5026bbbe7bd6984bc0e6d6de7631d Mon Sep 17 00:00:00 2001 From: Pablo Marquez Tello Date: Wed, 20 Apr 2022 18:19:19 +0100 Subject: NEQLSTM: perform type conversion in prepare method. * When input_to_forget_weights is QASYMM8_SIGNED, the conversion to QSYMM8 is done in the prepare method * Partially resolves MLCE-604 Change-Id: Iddadbc50d77381542451ac4e46de49b2706bc88c Signed-off-by: Pablo Marquez Tello Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/7441 Reviewed-by: Michalis Spyrou Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- src/runtime/NEON/functions/NEQLSTMLayer.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/runtime/NEON') diff --git a/src/runtime/NEON/functions/NEQLSTMLayer.cpp b/src/runtime/NEON/functions/NEQLSTMLayer.cpp index c6e6a71cb7..15569b4ead 100644 --- a/src/runtime/NEON/functions/NEQLSTMLayer.cpp +++ b/src/runtime/NEON/functions/NEQLSTMLayer.cpp @@ -252,8 +252,6 @@ void NEQLSTMLayer::configure(const ITensor *input, _dequantize_input_to_forget_weights.configure(input_to_forget_weights, &_input_to_forget_weights_f32); _quantize_input_to_forget_weights.configure(&_input_to_forget_weights_f32, &_input_to_forget_weights_symm8); - _input_to_forget_weights_f32.allocator()->allocate(); - _input_to_forget_weights_symm8.allocator()->allocate(); ARM_COMPUTE_ERROR_THROW_ON(NEQLSTMLayer::validate(input->info(), _input_to_forget_weights_symm8.info(), input_to_cell_weights->info(), input_to_output_weights->info(), recurrent_to_forget_weights->info(), recurrent_to_cell_weights->info(), recurrent_to_output_weights->info(), @@ -1055,12 +1053,6 @@ void NEQLSTMLayer::run() // Acquire all the temporaries MemoryGroupResourceScope scope_mg(_memory_group); - if(_convert_input_to_forget_weights_to_qsymm8) - { - _dequantize_input_to_forget_weights.run(); - _quantize_input_to_forget_weights.run(); - } - // Forget gate. _mm_input_to_forget.run(); _input_to_forget_outstage.run(); @@ -1200,6 +1192,14 @@ void NEQLSTMLayer::prepare() { if(!_is_prepared) { + if(_convert_input_to_forget_weights_to_qsymm8) + { + _input_to_forget_weights_f32.allocator()->allocate(); + _input_to_forget_weights_symm8.allocator()->allocate(); + _dequantize_input_to_forget_weights.run(); + _quantize_input_to_forget_weights.run(); + } + // Pre-transpose weights to be used in GEMM. _input_to_forget_weights_transposed.allocator()->allocate(); _input_to_cell_weights_transposed.allocator()->allocate(); -- cgit v1.2.1