diff options
author | Michalis Spyrou <michalis.spyrou@arm.com> | 2018-06-28 17:07:22 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:54:10 +0000 |
commit | 09daf4ddf5940d18ce95e7dd0859d1dace3b133e (patch) | |
tree | 7ef0057264816e17d1c09d4fe64a05a4dd2e5101 | |
parent | 9ebd04073f80f88515c4056a9d8bdda2641a4697 (diff) | |
download | ComputeLibrary-09daf4ddf5940d18ce95e7dd0859d1dace3b133e.tar.gz |
COMPMID-1246 Change CLLSTM in order to match android tests
Allow cell to input weights to be nullptr if CIFG and peephole are both enabled.
Change-Id: I6df705d69551f0fddeedd41b2044278d4575469c
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/137902
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
-rw-r--r-- | arm_compute/runtime/CL/functions/CLLSTMLayer.h | 6 | ||||
-rw-r--r-- | src/runtime/CL/functions/CLLSTMLayer.cpp | 5 | ||||
-rw-r--r-- | tests/validation/CL/LSTMLayer.cpp | 2 | ||||
-rw-r--r-- | tests/validation/fixtures/LSTMLayerFixture.h | 13 |
4 files changed, 6 insertions, 20 deletions
diff --git a/arm_compute/runtime/CL/functions/CLLSTMLayer.h b/arm_compute/runtime/CL/functions/CLLSTMLayer.h index cf47f34290..bed1fa9f56 100644 --- a/arm_compute/runtime/CL/functions/CLLSTMLayer.h +++ b/arm_compute/runtime/CL/functions/CLLSTMLayer.h @@ -96,15 +96,13 @@ public: } /** Set peephole tensor parameters. * - * @param[in] cell_to_input_weights 1D weights tensor with dimensions [num_units]. Data type supported: Data types supported: F16/F32. - * @param[in] cell_to_forget_weights 1D weights tensor with dimensions [num_units]. Data type supported: Same as @p cell_to_input_weights. + * @param[in] cell_to_forget_weights 1D weights tensor with dimensions [num_units]. Data type supported: Data types supported: F16/F32. * @param[in] cell_to_output_weights 1D weights tensor with dimensions [num_units]. Data type supported: Same as @p cell_to_input_weights. * * @return Reference to this LSTMParams object */ - LSTMParams &set_peephole_params(const T *cell_to_input_weights, const T *cell_to_forget_weights, const T *cell_to_output_weights) + LSTMParams &set_peephole_params(const T *cell_to_forget_weights, const T *cell_to_output_weights) { - _cell_to_input_weights = cell_to_input_weights; _cell_to_forget_weights = cell_to_forget_weights; _cell_to_output_weights = cell_to_output_weights; _has_peephole_opt = true; diff --git a/src/runtime/CL/functions/CLLSTMLayer.cpp b/src/runtime/CL/functions/CLLSTMLayer.cpp index 930d311d1d..a195ffa6b9 100644 --- a/src/runtime/CL/functions/CLLSTMLayer.cpp +++ b/src/runtime/CL/functions/CLLSTMLayer.cpp @@ -62,7 +62,7 @@ void CLLSTMLayer::configure(const ICLTensor *input, const ICLTensor *input_to_fo LSTMParams<ITensorInfo> lstm_params_info; if(lstm_params.has_peephole_opt()) { - lstm_params_info.set_peephole_params(lstm_params.cell_to_input_weights()->info(), lstm_params.cell_to_forget_weights()->info(), lstm_params.cell_to_output_weights()->info()); + lstm_params_info.set_peephole_params(lstm_params.cell_to_forget_weights()->info(), lstm_params.cell_to_output_weights()->info()); } if(lstm_params.has_projection()) { @@ -332,8 +332,7 @@ Status CLLSTMLayer::validate(const ITensorInfo *input, const ITensorInfo *input_ if(lstm_params.has_peephole_opt()) { - ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(lstm_params.cell_to_input_weights(), lstm_params.cell_to_output_weights(), lstm_params.cell_to_forget_weights()); - ARM_COMPUTE_RETURN_ERROR_ON(lstm_params.cell_to_input_weights()->num_dimensions() != 1); + ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(lstm_params.cell_to_output_weights(), lstm_params.cell_to_forget_weights()); ARM_COMPUTE_RETURN_ERROR_ON(lstm_params.cell_to_forget_weights()->num_dimensions() != 1); ARM_COMPUTE_RETURN_ERROR_ON(lstm_params.cell_to_output_weights()->num_dimensions() != 1); } diff --git a/tests/validation/CL/LSTMLayer.cpp b/tests/validation/CL/LSTMLayer.cpp index e1d4cbec49..fba9a88333 100644 --- a/tests/validation/CL/LSTMLayer.cpp +++ b/tests/validation/CL/LSTMLayer.cpp @@ -134,7 +134,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zi input_info, input_weights_info, recurrent_weights_info, cell_bias_info, projection_bias_info, cell_state_info, output_info, scratch_info, info, expected) { LSTMParams<ITensorInfo> lstm_params_info; - lstm_params_info.set_peephole_params(&cell_bias_info, &cell_bias_info, &cell_bias_info) + lstm_params_info.set_peephole_params(&cell_bias_info, &cell_bias_info) .set_projection_params(&recurrent_weights_info, &projection_bias_info) .set_cifg_params(&input_weights_info, &recurrent_weights_info, &cell_bias_info, &cell_bias_info); diff --git a/tests/validation/fixtures/LSTMLayerFixture.h b/tests/validation/fixtures/LSTMLayerFixture.h index b7e43b3470..bff2f375cd 100644 --- a/tests/validation/fixtures/LSTMLayerFixture.h +++ b/tests/validation/fixtures/LSTMLayerFixture.h @@ -115,13 +115,9 @@ protected: if(peephole_opt) { - if(cifg_opt) - { - cell_to_input_w = create_tensor<TensorType>(cell_bias_shape, data_type); - } cell_to_forget_w = create_tensor<TensorType>(cell_bias_shape, data_type); cell_to_output_w = create_tensor<TensorType>(cell_bias_shape, data_type); - lstm_params.set_peephole_params(&cell_to_input_w, &cell_to_forget_w, &cell_to_output_w); + lstm_params.set_peephole_params(&cell_to_forget_w, &cell_to_output_w); } if(projection_opt) @@ -221,13 +217,6 @@ protected: if(peephole_opt) { - if(cifg_opt) - { - ARM_COMPUTE_EXPECT(cell_to_input_w.info()->is_resizable(), framework::LogLevel::ERRORS); - cell_to_input_w.allocator()->allocate(); - ARM_COMPUTE_EXPECT(!cell_to_input_w.info()->is_resizable(), framework::LogLevel::ERRORS); - fill(AccessorType(cell_to_input_w), 15); - } ARM_COMPUTE_EXPECT(cell_to_forget_w.info()->is_resizable(), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(cell_to_output_w.info()->is_resizable(), framework::LogLevel::ERRORS); cell_to_forget_w.allocator()->allocate(); |