Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 25 of file matrix-sum-rows.cc.
References VectorBase< Real >::AddRowSumMat(), SequentialTableReader< Holder >::Done(), ParseOptions::GetArg(), KALDI_LOG, SequentialTableReader< Holder >::Key(), SequentialTableReader< Holder >::Next(), ParseOptions::NumArgs(), ParseOptions::PrintUsage(), ParseOptions::Read(), SequentialTableReader< Holder >::Value(), and TableWriter< Holder >::Write().
27 using namespace kaldi;
30 "Sum the rows of an input table of matrices and output the corresponding\n" 33 "Usage: matrix-sum-rows [options] <matrix-rspecifier> <vector-wspecifier>\n" 34 "e.g.: matrix-sum-rows ark:- ark:- | vector-sum ark:- sum.vec\n" 35 "See also: matrix-sum, vector-sum\n";
42 if (po.NumArgs() != 2) {
46 std::string rspecifier = po.GetArg(1);
47 std::string wspecifier = po.GetArg(2);
53 int64 num_rows_done = 0;
55 for (; !mat_reader.Done(); mat_reader.Next()) {
56 std::string key = mat_reader.Key();
62 vec_writer.Write(key, float_vec);
64 num_rows_done += mat.NumRows();
67 KALDI_LOG <<
"Summed rows " << num_done <<
" matrices, " 68 << num_rows_done <<
" rows in total.";
70 return (num_done != 0 ? 0 : 1);
71 }
catch(
const std::exception &e) {
72 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void AddRowSumMat(Real alpha, const MatrixBase< Real > &M, Real beta=1.0)
Does *this = alpha * (sum of rows of M) + beta * *this.
A templated class for writing objects to an archive or script file; see The Table concept...
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
A templated class for reading objects sequentially from an archive or script file; see The Table conc...