nnet-info.cc File Reference
#include "base/kaldi-common.h"
#include "util/common-utils.h"
#include "nnet/nnet-nnet.h"
Include dependency graph for nnet-info.cc:

Go to the source code of this file.

Functions

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

Function Documentation

◆ main()

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

Definition at line 24 of file nnet-info.cc.

References ParseOptions::GetArg(), Nnet::Info(), KALDI_LOG, ParseOptions::NumArgs(), ParseOptions::PrintUsage(), ParseOptions::Read(), Nnet::Read(), and Input::Stream().

24  {
25  try {
26  using namespace kaldi;
27  using namespace kaldi::nnet1;
28  typedef kaldi::int32 int32;
29 
30  const char *usage =
31  "Print human-readable information about the neural network.\n"
32  "(topology, various weight statistics, etc.) It prints to stdout.\n"
33  "Usage: nnet-info [options] <nnet-in>\n"
34  "e.g.:\n"
35  " nnet-info 1.nnet\n";
36 
37  ParseOptions po(usage);
38  po.Read(argc, argv);
39 
40  if (po.NumArgs() != 1) {
41  po.PrintUsage();
42  exit(1);
43  }
44 
45  std::string nnet_rxfilename = po.GetArg(1);
46 
47  // load the network
48  Nnet nnet;
49  {
50  bool binary_read;
51  Input ki(nnet_rxfilename, &binary_read);
52  nnet.Read(ki.Stream(), binary_read);
53  }
54 
55  std::cout << nnet.Info();
56 
57  KALDI_LOG << "Printed info about " << nnet_rxfilename;
58  return 0;
59  } catch(const std::exception &e) {
60  std::cerr << e.what();
61  return -1;
62  }
63 }
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
kaldi::int32 int32
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
Definition: parse-options.h:36
void Read(const std::string &rxfilename)
Read Nnet from &#39;rxfilename&#39;,.
Definition: nnet-nnet.cc:333
std::string Info() const
Create string with human readable description of the nnet,.
Definition: nnet-nnet.cc:386
#define KALDI_LOG
Definition: kaldi-error.h:153