27 : prior_scale_(opts.prior_scale) {
45 rel_freq = frame_counts;
46 rel_freq.
Scale(1.0/frame_counts.
Sum());
49 log_priors = rel_freq;
50 log_priors.
Add(1e-20);
57 int32 num_floored = 0;
60 log_priors(
i) = sqrt(FLT_MAX);
64 KALDI_LOG <<
"Floored " << num_floored <<
" pdf-priors " 65 <<
"(hard-set to " << sqrt(FLT_MAX)
66 <<
", which disables DNN output when decoding)";
78 KALDI_ERR <<
"--class-frame-counts is empty: Cannot initialize priors " 79 <<
"without the counts.";
84 <<
" pdf_output_llk " << llk->
NumCols();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
CuVector< BaseFloat > log_priors_
std::string class_frame_counts
#define KALDI_ISFINITE(x)
void ApplyLog()
Apply natural log to all elements.
void SubtractOnLogpost(CuMatrixBase< BaseFloat > *llk)
Subtract pdf priors from log-posteriors to get pseudo log-likelihoods.
PdfPrior(const PdfPriorOptions &opts)
Initialize pdf-prior from options.
void AddVecToRows(Real alpha, const CuVectorBase< Real > &row, Real beta=1.0)
(for each row r of *this), r = alpha * row + beta * r
MatrixIndexT Dim() const
Returns the dimension of the vector.
void Scale(Real alpha)
Multiplies all elements by this constant.
Real Sum() const
Returns sum of the elements.
Matrix for CUDA computing.
MatrixIndexT NumCols() const
#define KALDI_ASSERT(cond)
void Add(Real c)
Add a constant to each element of a vector.
void Read(std::istream &in, bool binary, bool add=false)
Read function using C++ streams.