31         "Sum multiple accumulated stats files for SGMM training.\n"    32         "Usage: sgmm2-sum-accs [options] stats-out stats-in1 stats-in2 ...\n";
    35     bool parallel = 
false;
    37     po.Register(
"binary", &binary, 
"Write output in binary mode");
    38     po.Register(
"parallel", ¶llel, 
"If true, the program makes sure to open all "    39                 "filehandles before reading for any (useful when summing accs from "    43     if (po.NumArgs() < 2) {
    48     std::string stats_out_filename = po.GetArg(1);
    53       std::vector<kaldi::Input*> inputs(po.NumArgs() - 1);
    54       for (
int i = 0; 
i < po.NumArgs() - 1; 
i++) {
    55         std::string stats_in_filename = po.GetArg(
i + 2);
    60       for (
size_t i = 0; 
i < po.NumArgs() - 1; 
i++) {
    63           transition_accs.
Read(inputs[
i]->Stream(), b, 
true );
    64           sgmm_accs.
Read(inputs[
i]->Stream(), b, 
true );
    67           KALDI_ERR << 
"Failed to read input stats file " << po.GetArg(
i + 2);
    71       for (
int i = 2, max = po.NumArgs(); 
i <= max; 
i++) {
    72         std::string stats_in_filename = po.GetArg(
i);
    75         transition_accs.
Read(ki.Stream(), binary_read, 
true );
    76         sgmm_accs.
Read(ki.Stream(), binary_read, 
true );
    83       transition_accs.
Write(ko.Stream(), binary);
    84       sgmm_accs.
Write(ko.Stream(), binary);
    87     KALDI_LOG << 
"Written stats to " << stats_out_filename;
    88   } 
catch(
const std::exception &e) {
    89     std::cerr << e.what() << 
'\n';
 bool InitKaldiInputStream(std::istream &is, bool *binary)
Initialize an opened stream for reading by detecting the binary header and. 
 
void Read(std::istream &in_stream, bool binary, bool add)
 
void Write(std::ostream &Out, bool binary) const
Writes to C++ stream (option to write in binary). 
 
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
 
void Write(std::ostream &out_stream, bool binary) const
 
Class for the accumulators associated with the phonetic-subspace model parameters. 
 
void Read(std::istream &in, bool binary, bool add=false)
Read function using C++ streams.