30     using namespace kaldi;
    33     typedef kaldi::int64 int64;
    36         "This program first identifies any affine or block affine layers that\n"    37         "are followed by pnorm and then renormalize layers. Then it rescales\n"    38         "those layers such that the parameter stddev is 1.0 after scaling\n"    39         "(the target stddev is configurable by the --stddev option).\n"    40         "If you supply the option --stddev-from=<model-filename>, it rescales\n"    41         "those layers to match the standard deviations of corresponding layers\n"    42         "in the specified model.\n"    44         "Usage: nnet-normalize-stddev [options] <model-in> <model-out>\n"    45         " e.g.: nnet-normalize-stddev final.mdl final.mdl\n";
    47     bool binary_write = 
true;
    49     std::string reference_model_filename;
    52     po.Register(
"binary", &binary_write, 
"Write output in binary mode");
    53     po.Register(
"stddev-from", &reference_model_filename, 
"Reference model");
    54     po.Register(
"stddev", &stddev, 
"Target standard deviation that we normalize "    55                 "to (note: is overridden by --stddev-from option, if supplied)");
    59     if (po.NumArgs() != 2) {
    64     std::string nnet_rxfilename = po.GetArg(1),
    65         normalized_nnet_rxfilename = po.GetArg(2);
    71       Input ki(nnet_rxfilename, &binary_read);
    72       trans_model.
Read(ki.Stream(), binary_read);
    73       am_nnet.
Read(ki.Stream(), binary_read);
    80     std::vector<int32> identified_components;
    90       if (ac == NULL && bac == NULL)
   104       if (nc == NULL && pwc == NULL)
   116       identified_components.push_back(c);
   120     if (!reference_model_filename.empty()) {
   122       Input ki(reference_model_filename, &binary_read);
   123       trans_model.
Read(ki.Stream(), binary_read);
   124       am_nnet_ref.
Read(ki.Stream(), binary_read);
   131     for (int32 c = 0; c < identified_components.size(); c++) {
   133       if (!reference_model_filename.empty()) {
   142         params.Add(-1.0 * params_average);
   143         ref_stddev = sqrt(
VecVec(params, params)
   144             / static_cast<BaseFloat>(params.Dim()));
   155       params.Add(-1.0 * params_average);
   157           / static_cast<BaseFloat>(params.Dim()));
   158       if (params_stddev > 0.0) {
   159         uc->
Scale(ref_stddev / params_stddev);
   160         KALDI_LOG << 
"Normalized component " << identified_components[c];
   165     Output ko(normalized_nnet_rxfilename, binary_write);
   166     trans_model.
Write(ko.Stream(), binary_write);
   167     am_nnet.
Write(ko.Stream(), binary_write);
   170   } 
catch(
const std::exception &e) {
   171     std::cerr << e.what() << 
'\n';
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
const Component & GetComponent(int32 c) const
 
virtual void Scale(BaseFloat scale)=0
This new virtual function scales the parameters by this amount. 
 
Abstract class, basic element of the network, it is a box with defined inputs, outputs, and tranformation functions interface. 
 
void Read(std::istream &is, bool binary)
 
virtual void Vectorize(VectorBase< BaseFloat > *params) const
Turns the parameters into vector form. 
 
int32 NumComponents() const
Returns number of components– think of this as similar to # of layers, but e.g. 
 
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
 
Take the absoute values of an input vector to a power. 
 
void Read(std::istream &is, bool binary)
 
void Write(std::ostream &os, bool binary) const
 
virtual int32 GetParameterDim() const
The following new virtual function returns the total dimension of the parameters in this class...
 
void Write(std::ostream &os, bool binary) const
 
A class representing a vector. 
 
#define KALDI_ASSERT(cond)
 
Real VecVec(const VectorBase< Real > &a, const VectorBase< Real > &b)
Returns dot product between v1 and v2. 
 
const Nnet & GetNnet() const
 
Class UpdatableComponent is a Component which has trainable parameters and contains some global param...