![]() |
LIMA
Libre Multilingual Analyzer — C++ API
|
Fusion of several torch modules implemented for inference in Eigen. More...
#include <deeplima/eigen_wrp/bilstm_and_dense.h>
Classes | |
| struct | params_bilstm_dense_argmax_t |
| struct | workbench_t |
Public Types | |
| typedef params_bilstm_dense_argmax_t | params_t |
Public Member Functions | |
| virtual std::shared_ptr< Op_Base::workbench_t > | create_workbench (uint32_t input_size, const std::shared_ptr< param_base_t > params, bool precomputed_input=false) const override |
| virtual bool | supports_precomputing () const |
| virtual void | precompute_inputs (const std::shared_ptr< param_base_t > params, const M &inputs, M &outputs, int64_t first_column) |
| virtual size_t | execute (std::shared_ptr< Op_Base::workbench_t > pwb, const M &input_matrix, const std::shared_ptr< param_base_t > pparams, std::vector< std::vector< uint8_t > > &final_output, size_t input_begin, size_t, size_t output_begin, size_t output_end) |
Public Member Functions inherited from deeplima::eigen_impl::Op_Base | |
| virtual | ~Op_Base () |
Protected Types | |
| typedef AuxScalar | fixed_point_t |
| using | MatrixWeight = typename std::conditional< std::is_integral_v< AuxScalar > &&std::is_signed_v< AuxScalar >, Eigen::Matrix< fixed_point_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >, M >::type |
| using | MatrixInput = typename std::conditional< std::is_integral_v< AuxScalar > &&std::is_signed_v< AuxScalar >, Eigen::Matrix< fixed_point_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor >, M >::type |
Protected Member Functions | |
| void | forward_pass (const size_t hidden_size, Eigen::Ref< const M > input, const MatrixWeight &weight_hh, V &s, V &c, M &output) |
| void | backward_pass (const size_t hidden_size, Eigen::Ref< const M > input, const MatrixWeight &weight_hh, V &s, V &c, M &output) |
| void | update_c (const size_t hidden_size, const V &s, V &c) |
| void | step_fw (const size_t hidden_size, const size_t t, const V &s, V &c, M &output) |
| void | step_bw (const size_t hidden_size, const size_t t, const V &s, V &c, M &output) |
Static Protected Attributes | |
| static constexpr fixed_point_t | WEIGHT_FRACTION_MULT = fixed_point_t(1) << WFracBits |
| static constexpr fixed_point_t | DATA_FRACTION_MULT = fixed_point_t(1) << IFracBits |
| static constexpr fixed_point_t | WEIGHT_DATA_FRACTION_MULT = fixed_point_t(1) << (WFracBits + IFracBits) |
Fusion of several torch modules implemented for inference in Eigen.
Precomputed inputs. The x of each gate is fasttext embeddings. They can be computed during model loading. This is done in precompute_inputs. This takes a very long time. This can be done in the first layer only
forward_pass is different for fixed point and non-fixed point
The implementation with factorization is less efficient while it should be more.
In linear layer on top of RNN outputs.
In fixed, only last step is in fixed because some necessary functions (tanh…) are not implemented in fixed but quicker nevertheless
Definition at line 55 of file bilstm_and_dense.h.
|
protected |
Definition at line 61 of file bilstm_and_dense.h.
|
protected |
Definition at line 65 of file bilstm_and_dense.h.
|
protected |
Definition at line 62 of file bilstm_and_dense.h.
| typedef params_bilstm_dense_argmax_t deeplima::eigen_impl::Op_BiLSTM_Dense_ArgMax< M, V, T, AuxScalar, IFracBits, WFracBits >::params_t |
Definition at line 185 of file bilstm_and_dense.h.
|
inlineprotected |
Definition at line 533 of file bilstm_and_dense.h.
|
inlineoverridevirtual |
Implements deeplima::eigen_impl::Op_Base.
Definition at line 187 of file bilstm_and_dense.h.
|
inlinevirtual |
Definition at line 239 of file bilstm_and_dense.h.
|
inlineprotected |
Definition at line 436 of file bilstm_and_dense.h.
|
inlinevirtual |
Definition at line 213 of file bilstm_and_dense.h.
|
inlineprotected |
Definition at line 600 of file bilstm_and_dense.h.
|
inlineprotected |
Definition at line 586 of file bilstm_and_dense.h.
|
inlinevirtual |
Definition at line 208 of file bilstm_and_dense.h.
|
inlineprotected |
Definition at line 573 of file bilstm_and_dense.h.
|
staticconstexprprotected |
Definition at line 70 of file bilstm_and_dense.h.
|
staticconstexprprotected |
Definition at line 71 of file bilstm_and_dense.h.
|
staticconstexprprotected |
Definition at line 69 of file bilstm_and_dense.h.