All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
sum-lda-accs.cc File Reference
Include dependency graph for sum-lda-accs.cc:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 25 of file sum-lda-accs.cc.

References ParseOptions::GetArg(), rnnlm::i, ParseOptions::NumArgs(), ParseOptions::PrintUsage(), LdaEstimate::Read(), ParseOptions::Read(), ParseOptions::Register(), Output::Stream(), and LdaEstimate::Write().

25  {
26  try {
27  using namespace kaldi;
28  typedef kaldi::int32 int32;
29 
30  const char *usage =
31  "Sum stats obtained with acc-lda.\n"
32  "Usage: sum-lda-accs [options] <stats-out> <stats-in1> <stats-in2> ...\n";
33 
34  bool binary = true;
35  ParseOptions po(usage);
36  po.Register("binary", &binary, "Write accumulators in binary mode.");
37  po.Read(argc, argv);
38 
39  if (po.NumArgs() < 2) {
40  po.PrintUsage();
41  exit(1);
42  }
43 
44  LdaEstimate lda;
45  std::string stats_out_filename = po.GetArg(1);
46 
47  for (int32 i = 2; i <= po.NumArgs(); i++) {
48  bool binary_in, add = true;
49  Input ki(po.GetArg(i), &binary_in);
50  lda.Read(ki.Stream(), binary_in, add);
51  }
52 
53  Output ko(stats_out_filename, binary);
54  lda.Write(ko.Stream(), binary);
55  return 0;
56  } catch(const std::exception &e) {
57  std::cerr << e.what();
58  return -1;
59  }
60 }
Relabels neural network egs with the read pdf-id alignments.
Definition: chain.dox:20
Class for computing linear discriminant analysis (LDA) transform.
Definition: lda-estimate.h:57
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
Definition: parse-options.h:36
void Read(std::istream &in_stream, bool binary, bool add)
void Write(std::ostream &out_stream, bool binary) const