25 int main(
int argc,
char *argv[]) {
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");
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 );
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 PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
void Write(std::ostream &Out, bool binary) const
Writes to C++ stream (option to write in binary).
BaseFloat TotCount() const
void Register(const std::string &name, bool *ptr, const std::string &doc)
BaseFloat TotLogLike() const
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
int main(int argc, char *argv[])
BaseFloat TotStatsCount() const
int Read(int argc, const char *const *argv)
Parses the command line options and fills the ParseOptions-registered variables.
std::string GetArg(int param) const
Returns one of the positional parameters; 1-based indexing for argc/argv compatibility.
void Read(std::istream &in_stream, bool binary, bool add=false)
int NumArgs() const
Number of positional parameters (c.f. argc-1).
void Write(std::ostream &out_stream, bool binary) const
void Read(std::istream &in, bool binary, bool add=false)
Read function using C++ streams.