Compute Library
18.05
|
This function performs a single time step in a Long Short-Term Memory (LSTM) layer. More...
#include <CLLSTMLayer.h>
Public Member Functions | |
CLLSTMLayer (std::shared_ptr< IMemoryManager > memory_manager=nullptr) | |
Default constructor. More... | |
void | configure (const ICLTensor *input, const ICLTensor *input_to_forget_weights, const ICLTensor *input_to_cell_weights, const ICLTensor *input_to_output_weights, const ICLTensor *recurrent_to_forget_weights, const ICLTensor *recurrent_to_cell_weights, const ICLTensor *recurrent_to_output_weights, const ICLTensor *forget_gate_bias, const ICLTensor *cell_bias, const ICLTensor *output_gate_bias, ICLTensor *output_state, ICLTensor *cell_state, ICLTensor *scratch_buffer, ICLTensor *output, const LSTMParams< ICLTensor > &lstm_params, const ActivationLayerInfo &activation_info, float cell_threshold=0.f, float projection_threshold=0.f) |
Initialize function's tensors. More... | |
void | run () override |
Run the kernels contained in the function. More... | |
Public Member Functions inherited from IFunction | |
virtual | ~IFunction ()=default |
Destructor. More... | |
virtual void | prepare () |
Prepare the function for executing. More... | |
Static Public Member Functions | |
static Status | validate (const ITensorInfo *input, const ITensorInfo *input_to_forget_weights, const ITensorInfo *input_to_cell_weights, const ITensorInfo *input_to_output_weights, const ITensorInfo *recurrent_to_forget_weights, const ITensorInfo *recurrent_to_cell_weights, const ITensorInfo *recurrent_to_output_weights, const ITensorInfo *forget_gate_bias, const ITensorInfo *cell_bias, const ITensorInfo *output_gate_bias, const ITensorInfo *output_state, const ITensorInfo *cell_state, const ITensorInfo *scratch_buffer, const ITensorInfo *output, const LSTMParams< ITensorInfo > &lstm_params, const ActivationLayerInfo &activation_info, float cell_threshold=0.f, float projection_threshold=0.f) |
Static function to check if given info will lead to a valid configuration of CLLSTMLayer. More... | |
This function performs a single time step in a Long Short-Term Memory (LSTM) layer.
Definition at line 186 of file CLLSTMLayer.h.
CLLSTMLayer | ( | std::shared_ptr< IMemoryManager > | memory_manager = nullptr | ) |
Default constructor.
void configure | ( | const ICLTensor * | input, |
const ICLTensor * | input_to_forget_weights, | ||
const ICLTensor * | input_to_cell_weights, | ||
const ICLTensor * | input_to_output_weights, | ||
const ICLTensor * | recurrent_to_forget_weights, | ||
const ICLTensor * | recurrent_to_cell_weights, | ||
const ICLTensor * | recurrent_to_output_weights, | ||
const ICLTensor * | forget_gate_bias, | ||
const ICLTensor * | cell_bias, | ||
const ICLTensor * | output_gate_bias, | ||
ICLTensor * | output_state, | ||
ICLTensor * | cell_state, | ||
ICLTensor * | scratch_buffer, | ||
ICLTensor * | output, | ||
const LSTMParams< ICLTensor > & | lstm_params, | ||
const ActivationLayerInfo & | activation_info, | ||
float | cell_threshold = 0.f , |
||
float | projection_threshold = 0.f |
||
) |
Initialize function's tensors.
[in] | input | Source tensor. Input is a 2D tensor with dimensions [input_size, batch_size]. Data types supported: F16/F32. |
[in] | input_to_forget_weights | 2D weights tensor with dimensions [input_size, num_units]. Data type supported: Same as input . |
[in] | input_to_cell_weights | 2D weights tensor with dimensions [input_size, num_units]. Data type supported: Same as input . |
[in] | input_to_output_weights | 2D weights tensor with dimensions [input_size, num_units]. Data type supported: Same as input . |
[in] | recurrent_to_forget_weights | 2D weights tensor with dimensions [output_size, num_units]. Data type supported: Same as input . |
[in] | recurrent_to_cell_weights | 2D weights tensor with dimensions [output_size, num_units]. Data type supported: Same as input . |
[in] | recurrent_to_output_weights | 2D weights tensor with dimensions [output_size, num_units]. Data type supported: Same as input . |
[in] | forget_gate_bias | 1D weights tensor with dimensions [num_units]. Data type supported: Same as input . |
[in] | cell_bias | 1D weights tensor with dimensions [num_units]. Data type supported: Same as input . |
[in] | output_gate_bias | 1D weights tensor with dimensions [num_units]. Data type supported: Same as input . |
[in,out] | output_state | 2D weights tensor with dimensions [output_size, batch_size]. Data type supported: Same as input . |
[in,out] | cell_state | 2D tensor with dimensions [num_units, batch_size]. Data type supported: Same as input . |
[out] | scratch_buffer | 2D tensor with dimensions [num_units * 4, batch_size] with CIFG or [num_units * 3, batch_size] without CIGF. Data type supported: Same as input . |
[out] | output | Destination tensor. Output is a 2D tensor with dimensions [output_size, batch_size]. Data types supported: Same as input . |
[in] | lstm_params | (Optional) Weights tensors used in peephole optimization: input_to_input_weights 2D weights tensor with dimensions [input_size, num_units]. Data type supported: Same as input . recurrent_to_input_weights 2D weights tensor with dimensions [output_size, num_units]. Data type supported: Same as input . cell_to_input_weights 1D weights tensor with dimensions [num_units]. Can be nullptr. Data type supported: Same as input . cell_to_forget_weights 1D weights tensor with dimensions [num_units]. Data type supported: Same as input . cell_to_output_weights 1D weights tensor with dimensions [num_units]. Data type supported: Same as input . input_gate_bias 1D weights tensor with dimensions [num_units]. Data type supported: Same as input projection_weights 2D weights tensor with dimensions [output_size, num_units]. Data type supported: Same as input . projection_bias 1D weights tensor with dimensions [output_size]. Data type supported: Same as input . |
[in] | activation_info | Contains activation information described in ActivationLayerInfo. |
[in] | cell_threshold | The clipping threshold for the cell state, such that values are bound within [-cell_clip, cell_clip]. If set to 0.0 then clipping is disabled. |
[in] | projection_threshold | The clipping threshold for the output from the projection layer, such that values are bound within [-proj_clip, proj_clip]. If set to 0.0 then clipping is disabled. |
|
overridevirtual |
Run the kernels contained in the function.
For NEON kernels:
For OpenCL kernels:
Implements IFunction.
|
static |
Static function to check if given info will lead to a valid configuration of CLLSTMLayer.
[in] | input | Source tensor info. Input is a 2D tensor info with dimensions [input_size, batch_size]. Data types supported: F16/F32. |
[in] | input_to_forget_weights | 2D weights tensor info with dimensions [input_size, num_units]. Data type supported: Same as input . |
[in] | input_to_cell_weights | 2D weights tensor info with dimensions [input_size, num_units]. Data type supported: Same as input . |
[in] | input_to_output_weights | 2D weights tensor info with dimensions [input_size, num_units]. Data type supported: Same as input . |
[in] | recurrent_to_forget_weights | 2D weights tensor info with dimensions [output_size, num_units]. Data type supported: Same as input . |
[in] | recurrent_to_cell_weights | 2D weights tensor info with dimensions [output_size, num_units]. Data type supported: Same as input . |
[in] | recurrent_to_output_weights | 2D weights tensor info with dimensions [output_size, num_units]. Data type supported: Same as input . |
[in] | forget_gate_bias | 1D weights tensor info with dimensions [num_units]. Data type supported: Same as input . |
[in] | cell_bias | 1D weights tensor info with dimensions [num_units]. Data type supported: Same as input . |
[in] | output_gate_bias | 1D weights tensor info with dimensions [num_units]. Data type supported: Same as input . |
[in] | output_state | 2D weights tensor info with dimensions [output_size, batch_size]. Data type supported: Same as input . |
[in] | cell_state | 2D tensor info with dimensions [num_units, batch_size]. Data type supported: Same as input . |
[in] | scratch_buffer | 2D tensor info with dimensions [num_units * 4, batch_size] with CIFG or [num_units * 3, batch_size] without CIGF. Data type supported: Same as input . |
[in] | output | Destination tensor info. Output is a 2D tensor with dimensions [output_size, batch_size]. Data types supported: Same as input . |
[in] | lstm_params | (Optional) Weights tensors used in peephole optimization: input_to_input_weights 2D weights tensor with dimensions [input_size, num_units]. Data type supported: Same as input . recurrent_to_input_weights 2D weights tensor with dimensions [output_size, num_units]. Data type supported: Same as input . cell_to_input_weights 1D weights tensor with dimensions [num_units]. Can be nullptr. Data type supported: Same as input . cell_to_forget_weights 1D weights tensor with dimensions [num_units]. Data type supported: Same as input . cell_to_output_weights 1D weights tensor with dimensions [num_units]. Data type supported: Same as input . input_gate_bias 1D weights tensor with dimensions [num_units]. Data type supported: Same as input projection_weights 2D weights tensor with dimensions [output_size, num_units]. Data type supported: Same as input . projection_bias 1D weights tensor with dimensions [output_size]. Data type supported: Same as input . |
[in] | activation_info | Contains activation information described in ActivationLayerInfo. |
[in] | cell_threshold | The clipping threshold for the cell state, such that values are bound within [-cell_clip, cell_clip]. If set to 0.0 then clipping is disabled. |
[in] | projection_threshold | The clipping threshold for the output from the projection layer, such that values are bound within [-proj_clip, proj_clip]. If set to 0.0 then clipping is disabled. |
Referenced by arm_compute::test::validation::DATA_TEST_CASE().