23 #ifndef KALDI_CUDAMATRIX_CU_MATH_H_ 24 #define KALDI_CUDAMATRIX_CU_MATH_H_ 38 template<
typename Real>
39 void RegularizeL1(CuMatrixBase<Real> *weight, CuMatrixBase<Real> *gradient,
40 Real l1_penalty, Real learning_rate);
46 template<
typename Real>
47 void Randomize(
const CuMatrixBase<Real> &src,
48 const CuArray<int32> ©_from_idx,
49 CuMatrixBase<Real> *tgt);
61 template<
typename Real>
62 void Splice(
const CuMatrixBase<Real> &src,
63 const CuArray<int32> &frame_offsets,
64 CuMatrixBase<Real> *tgt);
71 template<
typename Real>
72 void Copy(
const CuMatrixBase<Real> &src,
73 const CuArray<int32> ©_from_indices,
74 CuMatrixBase<Real> *tgt);
85 template <
typename Real>
88 CuMatrixBase<Real> *dest);
91 template <
typename Real>
94 CuVectorBase<Real> *dest);
131 template<
typename Real>
133 const CuMatrixBase<Real> ¶ms,
134 CuMatrixBase<Real> *output);
137 template<
typename Real>
139 const MatrixBase<Real> ¶ms,
140 MatrixBase<Real> *output);
232 template<
typename Real>
234 const CuMatrixBase<Real> ¶ms,
235 const CuMatrixBase<Real> &output_deriv,
236 const CuMatrixBase<double> &deriv_sum_in,
237 const CuVectorBase<Real> &self_repair_config,
239 CuMatrixBase<Real> *input_deriv,
240 CuMatrixBase<Real> *params_deriv,
241 CuMatrixBase<double> *value_sum_out,
242 CuMatrixBase<double> *deriv_sum_out,
243 CuMatrixBase<Real> *self_repair_sum_out);
246 template<
typename Real>
248 const MatrixBase<Real> ¶ms,
249 const MatrixBase<Real> &output_deriv,
250 const MatrixBase<double> &deriv_sum_in,
251 const VectorBase<Real> &self_repair_config,
253 MatrixBase<Real> *input_deriv,
254 MatrixBase<Real> *params_deriv,
255 MatrixBase<double> *value_sum_out,
256 MatrixBase<double> *deriv_sum_out,
257 MatrixBase<Real> *self_repair_sum_out);
271 template<
typename Real>
272 void NormalizePerRow(
const CuMatrixBase<Real>& in,
const Real target_rms,
273 const bool add_log_stddev, CuMatrixBase<Real>* out);
295 template<
typename Real>
297 const CuMatrixBase<Real> &out_deriv,
298 const Real target_rms,
const bool add_log_stddev,
299 CuMatrixBase<Real>* in_deriv);
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void CpuComputeLstmNonlinearity(const MatrixBase< Real > &input_mat, const MatrixBase< Real > ¶ms_mat, MatrixBase< Real > *output)
void Randomize(const CuMatrixBase< Real > &src, const CuArray< int32 > ©_from_idx, CuMatrixBase< Real > *tgt)
Copies a permutation of src into tgt.
void BackpropLstmNonlinearity(const CuMatrixBase< Real > &input, const CuMatrixBase< Real > ¶ms, const CuMatrixBase< Real > &output_deriv, const CuMatrixBase< double > &deriv_sum_in, const CuVectorBase< Real > &self_repair_config, double count_in, CuMatrixBase< Real > *input_deriv, CuMatrixBase< Real > *params_deriv, CuMatrixBase< double > *value_sum_out, CuMatrixBase< double > *deriv_sum_out, CuMatrixBase< Real > *self_repair_sum_out)
This function does the 'backward' pass corresponding to the function ComputeLstmNonlinearity.
void DiffNormalizePerRow(const CuMatrixBase< Real > &in_value, const CuMatrixBase< Real > &out_deriv, const Real target_rms, const bool add_log_stddev, CuMatrixBase< Real > *in_deriv)
void EnsureNonzero(const CuMatrixBase< Real > &src, Real epsilon, CuMatrixBase< Real > *dest)
This function requires that src and dest have the same dimension and epsilon > 0. ...
void Splice(const CuMatrixBase< Real > &src, const CuArray< int32 > &frame_offsets, CuMatrixBase< Real > *tgt)
Splice concatenates frames of src as specified in frame_offsets into tgt.
void NormalizePerRow(const CuMatrixBase< Real > &in, const Real target_rms, const bool add_log_stddev, CuMatrixBase< Real > *out)
Normalize nonlinearity modifies the vector of activations by scaling it so that the root-mean-square ...
void RegularizeL1(CuMatrixBase< Real > *weight, CuMatrixBase< Real > *grad, Real l1, Real lr)
RegularizeL1 is a gradient step with l1 regularization added to the gradient.
void Copy(const CuMatrixBase< Real > &src, const CuArray< int32 > ©_from_indices, CuMatrixBase< Real > *tgt)
Copies elements from src into tgt as given by copy_from_indices.
void CpuBackpropLstmNonlinearity(const MatrixBase< Real > &input, const MatrixBase< Real > ¶ms, const MatrixBase< Real > &output_deriv, const MatrixBase< double > &deriv_sum_in, const VectorBase< Real > &self_repair_config, double count_in, MatrixBase< Real > *input_deriv, MatrixBase< Real > *params_deriv, MatrixBase< double > *value_sum_out, MatrixBase< double > *deriv_sum_out, MatrixBase< Real > *self_repair_sum_out)
void ComputeLstmNonlinearity(const CuMatrixBase< Real > &input, const CuMatrixBase< Real > ¶ms, CuMatrixBase< Real > *output)
this is a special-purpose function used by class LstmNonlinearityComponent, to do its forward propaga...