31                         std::vector<std::string> *tokens) {
    33   size_t start = input.find_first_not_of(
" \t"), size = input.size();
    35   while (start < size) {
    37     if (input[start] == 
'(' || input[start] == 
')' || input[start] == 
',') {
    38       tokens->push_back(std::string(input, start, 1));
    39       start = input.find_first_not_of(
" \t", start + 1);
    41       size_t found = input.find_first_of(
" \t(),", start);
    43       if (found == std::string::npos) {
    44         std::string str(input, start, input.size() - start);
    50         tokens->push_back(str);
    53         if (input[found] == 
'(' || input[found] == 
')' || input[found] == 
',') {
    54           std::string str(input, start, found - start);
    60           tokens->push_back(str);
    63           std::string str(input, start, found - start);
    69           tokens->push_back(str);
    70           start = input.find_first_not_of(
" \t", found);
    79   if (!is.good()) 
return "end of line";
    83     return (std::string(buf, 20) + 
"...");
    85   return std::string(buf, is.gcount());
    89   if (str.size() == 0) 
return "end of line";
    90   if (str.size() <= 20) 
return str;
    91   return std::string(str, 0, 20) + 
"...";
    95   if (fabs(f) < 10000.0 && fabs(f) >= 10.0) {
    96     os  << std::fixed << std::setprecision(0) << f;
    97   } 
else if (fabs(f) >= 0.995) {
    98     os  << std::fixed << std::setprecision(1) << f;
    99   } 
else if (fabs(f) >= 0.01) {
   100     os  << std::fixed << std::setprecision(2) << f;
   102     os << std::setprecision(1) << f;
   104   os.unsetf(std::ios_base::floatfield);
   105   os << std::setprecision(6);  
   112   std::ostringstream os;
   113   if (vec.
Dim() < 10) {
   123         stddev = sqrt(
VecVec(vec, vec) / vec.
Dim() - mean * mean);
   125     std::string percentiles_str = 
"0,1,2,5 10,20,50,80,90 95,98,99,100";
   126     std::vector<int32> percentiles;
   130     os << 
"[percentiles(" << percentiles_str << 
")=(";
   132     std::sort(vec_sorted.
Data(), vec_sorted.
Data() + vec_sorted.
Dim());
   134     for (
size_t i = 0; 
i < percentiles.size(); 
i++) {
   135       int32 percentile = percentiles[
i];
   136       BaseFloat value = vec_sorted((n * percentile) / 100);
   138       if (
i + 1 < percentiles.size())
   139         os << (
i == 3 || 
i == 8 ? 
' ' : 
',');
   141     os << std::setprecision(3);
   142     os << 
"), mean=" << mean << 
", stddev=" << stddev << 
"]";
   158                          const std::string &name,
   161   os << std::setprecision(4);
   162   os << 
", " << name << 
'-';
   165         stddev = std::sqrt(
VecVec(params, params) / params.
Dim() - mean * mean);
   166     os << 
"{mean,stddev}=" << mean << 
',' << stddev;
   171   os << std::setprecision(6);  
   175                          const std::string &name,
   178                          bool include_row_norms,
   179                          bool include_column_norms,
   180                          bool include_singular_values) {
   181   os << std::setprecision(4);
   182   os << 
", " << name << 
'-';
   188     os << 
"{mean,stddev}=" << mean << 
',' << stddev;
   193   os << std::setprecision(6);  
   195   if (include_row_norms) {
   198     row_norms.ApplyPow(0.5);
   200     row_norms.
Swap(&row_norms_cpu);
   201     os << 
", " << name << 
"-row-norms="   204   if (include_column_norms) {
   207     col_norms.ApplyPow(0.5);
   209     col_norms.
Swap(&col_norms_cpu);
   210     os << 
", " << name << 
"-col-norms="   213   if (include_singular_values) {
   218     os << 
", " << name << 
"-singular-values=" << singular_values_str;
   219     std::ostringstream name_os;
   225                       std::vector<ConfigLine> *config_lines) {
   226   config_lines->resize(lines.size());
   227   for (
size_t i = 0; 
i < lines.size(); 
i++) {
   228     bool ret = (*config_lines)[
i].ParseLine(lines[
i]);
   230       KALDI_ERR << 
"Error parsing config line: " << lines[
i];
   236   if (*pattern == 
'*') {
   239   } 
else if (*name == *pattern) {
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
bool SplitStringToIntegers(const std::string &full, const char *delim, bool omit_empty_strings, std::vector< I > *out)
Split a string (e.g. 
 
bool DescriptorTokenize(const std::string &input, std::vector< std::string > *tokens)
This function tokenizes input when parsing Descriptor configuration values. 
 
std::string SummarizeVector(const VectorBase< float > &vec)
Returns a string that summarizes a vector fairly succintly, for printing stats in info lines...
 
void AddDiagMat2(Real alpha, const CuMatrixBase< Real > &M, MatrixTransposeType trans, Real beta)
Add the diagonal of a matrix times itself: *this = diag(M M^T) + beta * *this (if trans == kNoTrans)...
 
This class represents a matrix that's stored on the GPU if we have one, and in memory if not...
 
bool IsValidName(const std::string &name)
Returns true if 'name' would be a valid name for a component or node in a nnet3Nnet. 
 
bool NameMatchesPattern(const char *name, const char *pattern)
 
std::string ErrorContext(std::istream &is)
Return a string used in error messages. 
 
void ParseConfigLines(const std::vector< std::string > &lines, std::vector< ConfigLine > *config_lines)
 
void Swap(Vector< Real > *other)
Swaps the contents of *this and *other. Shallow swap. 
 
bool ConvertStringToReal(const std::string &str, T *out)
ConvertStringToReal converts a string into either float or double and returns false if there was any ...
 
Real TraceMatMat(const MatrixBase< Real > &A, const MatrixBase< Real > &B, MatrixTransposeType trans)
We need to declare this here as it will be a friend function. 
 
Real * Data()
Returns a pointer to the start of the vector's data. 
 
MatrixIndexT Dim() const
Returns the dimension of the vector. 
 
Real Sum() const
Returns sum of the elements. 
 
MatrixIndexT NumCols() const
 
A class representing a vector. 
 
#define KALDI_ASSERT(cond)
 
static void PrintFloatSuccinctly(std::ostream &os, BaseFloat f)
 
void Svd(VectorBase< Real > *s, MatrixBase< Real > *U, MatrixBase< Real > *Vt) const
Compute SVD (*this) = U diag(s) Vt. 
 
void PrintParameterStats(std::ostringstream &os, const std::string &name, const CuVectorBase< BaseFloat > ¶ms, bool include_mean)
Print to 'os' some information about the mean and standard deviation of some parameters, used in Info() functions in nnet-simple-component.cc. 
 
MatrixIndexT NumRows() const
Dimensions. 
 
Provides a vector abstraction class. 
 
Real VecVec(const VectorBase< Real > &a, const VectorBase< Real > &b)
Returns dot product between v1 and v2. 
 
MatrixIndexT Dim() const
Dimensions. 
 
Vector for CUDA computing.