From 25f45a4a0158a709d28a5207a867a9b5ce390621 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Wed, 8 Aug 2018 12:53:05 +0100 Subject: COMPMID-1060 LSTM FP32 NEON Change-Id: I0bdf874e61917903c26f713ec41a7ffc29e07233 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/143892 Tested-by: Jenkins Reviewed-by: Georgios Pinitas --- arm_compute/runtime/CL/functions/CLLSTMLayer.h | 133 +------------------------ 1 file changed, 1 insertion(+), 132 deletions(-) (limited to 'arm_compute/runtime/CL/functions/CLLSTMLayer.h') diff --git a/arm_compute/runtime/CL/functions/CLLSTMLayer.h b/arm_compute/runtime/CL/functions/CLLSTMLayer.h index 6896a97e31..72e41a7aca 100644 --- a/arm_compute/runtime/CL/functions/CLLSTMLayer.h +++ b/arm_compute/runtime/CL/functions/CLLSTMLayer.h @@ -39,6 +39,7 @@ #include "arm_compute/runtime/CL/functions/CLGEMM.h" #include "arm_compute/runtime/CL/functions/CLWidthConcatenateLayer.h" #include "arm_compute/runtime/IMemoryManager.h" +#include "arm_compute/runtime/common/LSTMParams.h" #include @@ -46,138 +47,6 @@ namespace arm_compute { class ICLTensor; -template -class LSTMParams -{ -public: - /** Constructor */ - LSTMParams() - : _input_to_input_weights(nullptr), _recurrent_to_input_weights(nullptr), _cell_to_input_weights(nullptr), _input_gate_bias(nullptr), _cell_to_forget_weights(nullptr), - _cell_to_output_weights(nullptr), _projection_weights(nullptr), _projection_bias(nullptr), _has_peephole_opt(false), _has_projection(false), _has_cifg_opt(true) - { - } - /** Prevent instances of this class from being copied (As this class contains pointers) */ - LSTMParams(const LSTMParams &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - LSTMParams &operator=(const LSTMParams &) = delete; - /** Default destructor */ - ~LSTMParams() = default; - /** Set CIFG tensor parameters. - * - * @param[in] input_to_input_weights 2D weights tensor with dimensions [input_size, num_units]. Data types supported: F16/F32. - * @param[in] recurrent_to_input_weights 2D weights tensor with dimensions [output_size, num_units]. Data type supported: Same as @p input_to_input_weights. - * @param[in] cell_to_input_weights 1D weights tensor with dimensions [num_units]. Can be nullptr. Data type supported: Same as @p input_to_input_weights. - * @param[in] input_gate_bias 1D weights tensor with dimensions [num_units]. Data type supported: Same as @p input_to_input_weights - * - * @return Reference to this LSTMParams object - */ - LSTMParams &set_cifg_params(const T *input_to_input_weights, const T *recurrent_to_input_weights, const T *cell_to_input_weights, const T *input_gate_bias) - { - _input_to_input_weights = input_to_input_weights; - _recurrent_to_input_weights = recurrent_to_input_weights; - _cell_to_input_weights = cell_to_input_weights; - _input_gate_bias = input_gate_bias; - _has_cifg_opt = false; - return *this; - } - /** Set projection tensor parameters. - * - * @param[in] projection_weights 2D weights tensor with dimensions [output_size, num_units]. Data type supported: Data types supported: F16/F32. - * @param[in] projection_bias 1D weights tensor with dimensions [output_size]. Data type supported: Same as @p projection_weights. - * - * @return Reference to this LSTMParams object - */ - LSTMParams &set_projection_params(const T *projection_weights, const T *projection_bias) - { - _projection_weights = projection_weights; - _projection_bias = projection_bias; - _has_projection = true; - return *this; - } - /** Set peephole tensor parameters. - * - * @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_forget_weights, const T *cell_to_output_weights) - { - _cell_to_forget_weights = cell_to_forget_weights; - _cell_to_output_weights = cell_to_output_weights; - _has_peephole_opt = true; - return *this; - } - - const T *input_to_input_weights() const - { - return _input_to_input_weights; - } - - const T *recurrent_to_input_weights() const - { - return _recurrent_to_input_weights; - } - - const T *cell_to_input_weights() const - { - return _cell_to_input_weights; - } - - const T *input_gate_bias() const - { - return _input_gate_bias; - } - - const T *cell_to_forget_weights() const - { - return _cell_to_forget_weights; - } - - const T *cell_to_output_weights() const - { - return _cell_to_output_weights; - } - - const T *projection_weights() const - { - return _projection_weights; - } - - const T *projection_bias() const - { - return _projection_bias; - } - - bool has_peephole_opt() const - { - return _has_peephole_opt; - } - - bool has_projection() const - { - return _has_projection; - } - - bool has_cifg_opt() const - { - return _has_cifg_opt; - } - -private: - const T *_input_to_input_weights; - const T *_recurrent_to_input_weights; - const T *_cell_to_input_weights; - const T *_input_gate_bias; - const T *_cell_to_forget_weights; - const T *_cell_to_output_weights; - const T *_projection_weights; - const T *_projection_bias; - bool _has_peephole_opt; - bool _has_projection; - bool _has_cifg_opt; -}; - /** This function performs a single time step in a Long Short-Term Memory (LSTM) layer. * */ -- cgit v1.2.1