30 "Sum multiple accumulated stats files for GMM training.\n" 31 "Usage: gmm-sum-accs [options] <stats-out> <stats-in1> <stats-in2> ...\n" 32 "E.g.: gmm-sum-accs 1.acc 1.1.acc 1.2.acc\n";
36 po.Register(
"binary", &binary,
"Write output in binary mode");
39 if (po.NumArgs() < 2) {
44 std::string stats_out_filename = po.GetArg(1);
48 int num_accs = po.NumArgs() - 1;
49 for (
int i = 2, max = po.NumArgs();
i <= max;
i++) {
50 std::string stats_in_filename = po.GetArg(
i);
53 transition_accs.
Read(ki.Stream(), binary_read,
true );
54 gmm_accs.
Read(ki.Stream(), binary_read,
true );
60 transition_accs.
Write(ko.Stream(), binary);
61 gmm_accs.
Write(ko.Stream(), binary);
63 KALDI_LOG <<
"Summed " << num_accs <<
" stats, total count " 64 << gmm_accs.
TotCount() <<
", avg like/frame " 67 KALDI_LOG <<
"Written stats to " << stats_out_filename;
68 }
catch(
const std::exception &e) {
69 std::cerr << e.what() <<
'\n';
void Write(std::ostream &Out, bool binary) const
Writes to C++ stream (option to write in binary).
BaseFloat TotCount() const
BaseFloat TotLogLike() const
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
BaseFloat TotStatsCount() const
void Read(std::istream &in_stream, bool binary, bool add=false)
void Write(std::ostream &out_stream, bool binary) const
void Read(std::istream &in, bool binary, bool add=false)
Read function using C++ streams.