raw-nnet-info.cc
Go to the documentation of this file.
1 // nnet2bin/raw-nnet-info.cc
2 
3 // Copyright 2013 Johns Hopkins University (author: Daniel Povey)
4 
5 // See ../../COPYING for clarification regarding multiple authors
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15 // WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16 // MERCHANTABLITY OR NON-INFRINGEMENT.
17 // See the Apache 2 License for the specific language governing permissions and
18 // limitations under the License.
19 
20 #include "base/kaldi-common.h"
21 #include "util/common-utils.h"
22 #include "hmm/transition-model.h"
23 #include "nnet2/nnet-nnet.h"
24 
25 int main(int argc, char *argv[]) {
26  try {
27  using namespace kaldi;
28  using namespace kaldi::nnet2;
29  typedef kaldi::int32 int32;
30 
31  const char *usage =
32  "Print human-readable information about the raw neural network\n"
33  "to the standard output\n"
34  "Usage: raw-nnet-info [options] <nnet-in>\n"
35  "e.g.:\n"
36  " raw-nnet-info 1.nnet\n";
37 
38  ParseOptions po(usage);
39 
40  po.Read(argc, argv);
41 
42  if (po.NumArgs() != 1) {
43  po.PrintUsage();
44  exit(1);
45  }
46 
47  std::string raw_nnet_rxfilename = po.GetArg(1);
48 
49  Nnet nnet;
50  ReadKaldiObject(raw_nnet_rxfilename, &nnet);
51 
52  std::cout << nnet.Info();
53 
54  KALDI_LOG << "Printed info about " << raw_nnet_rxfilename;
55  } catch(const std::exception &e) {
56  std::cerr << e.what() << '\n';
57  return -1;
58  }
59 }
60 
61 
62 
63 
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
kaldi::int32 int32
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
Definition: kaldi-io.cc:832
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
Definition: parse-options.h:36
int Read(int argc, const char *const *argv)
Parses the command line options and fills the ParseOptions-registered variables.
std::string Info() const
Definition: nnet-nnet.cc:257
std::string GetArg(int param) const
Returns one of the positional parameters; 1-based indexing for argc/argv compatibility.
int NumArgs() const
Number of positional parameters (c.f. argc-1).
int main(int argc, char *argv[])
#define KALDI_LOG
Definition: kaldi-error.h:153