nnet-parse.h
Go to the documentation of this file.
1 // nnet3/nnet-parse.h
2 
3 // Copyright 2015 Johns Hopkins University (author: Daniel Povey)
4 
5 // See ../../COPYING for clarification regarding multiple authors
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15 // WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16 // MERCHANTABLITY OR NON-INFRINGEMENT.
17 // See the Apache 2 License for the specific language governing permissions and
18 // limitations under the License.
19 
20 #ifndef KALDI_NNET3_NNET_PARSE_H_
21 #define KALDI_NNET3_NNET_PARSE_H_
22 
23 #include "util/text-utils.h"
24 #include "matrix/kaldi-vector.h"
25 
26 namespace kaldi {
27 namespace nnet3 {
28 
29 
45 bool DescriptorTokenize(const std::string &input,
46  std::vector<std::string> *tokens);
47 
48 
49 /*
50  Returns true if name 'name' matches pattern 'pattern'. The pattern
51  format is: everything is literal, except '*' matches zero or more
52  characters. (Like filename globbing in UNIX).
53  */
54 bool NameMatchesPattern(const char *name,
55  const char *pattern);
56 
57 
65 std::string ErrorContext(std::istream &is);
66 
67 std::string ErrorContext(const std::string &str);
68 
74 std::string SummarizeVector(const VectorBase<float> &vec);
75 
76 std::string SummarizeVector(const VectorBase<double> &vec);
77 
78 std::string SummarizeVector(const CuVectorBase<BaseFloat> &vec);
79 
89 void PrintParameterStats(std::ostringstream &os,
90  const std::string &name,
91  const CuVectorBase<BaseFloat> &params,
92  bool include_mean = false);
93 
112 void PrintParameterStats(std::ostringstream &os,
113  const std::string &name,
114  const CuMatrix<BaseFloat> &params,
115  bool include_mean = false,
116  bool include_row_norms = false,
117  bool include_column_norms = false,
118  bool include_singular_values = false);
119 
120 
121 } // namespace nnet3
122 } // namespace kaldi
123 
124 
125 #endif
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
bool DescriptorTokenize(const std::string &input, std::vector< std::string > *tokens)
This function tokenizes input when parsing Descriptor configuration values.
Definition: nnet-parse.cc:30
std::string SummarizeVector(const VectorBase< float > &vec)
Returns a string that summarizes a vector fairly succintly, for printing stats in info lines...
Definition: nnet-parse.cc:111
bool NameMatchesPattern(const char *name, const char *pattern)
Definition: nnet-parse.cc:235
std::string ErrorContext(std::istream &is)
Return a string used in error messages.
Definition: nnet-parse.cc:78
void PrintParameterStats(std::ostringstream &os, const std::string &name, const CuVectorBase< BaseFloat > &params, bool include_mean)
Print to &#39;os&#39; some information about the mean and standard deviation of some parameters, used in Info() functions in nnet-simple-component.cc.
Definition: nnet-parse.cc:157