decodable-am-sgmm2.cc
Go to the documentation of this file.
1 // sgmm2/decodable-am-sgmm2.cc
2 
3 // Copyright 2009-2012 Saarland University; Lukas Burget;
4 // Johns Hopkins University (author: Daniel Povey)
5 
6 // See ../../COPYING for clarification regarding multiple authors
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 //
12 // http://www.apache.org/licenses/LICENSE-2.0
13 //
14 // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 // KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
16 // WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
17 // MERCHANTABLITY OR NON-INFRINGEMENT.
18 // See the Apache 2 License for the specific language governing permissions and
19 // limitations under the License.
20 
21 #include <vector>
22 using std::vector;
23 
25 
26 namespace kaldi {
27 
28 
30  if (delete_vars_) {
31  delete gselect_;
32  delete feature_matrix_;
33  delete spk_;
34  }
35 }
36 
38  if (frame != cur_frame_) {
39  cur_frame_ = frame;
40  sgmm_cache_.NextFrame(); // it has a frame-index internally but it doesn't
41  // have to match up with our index here, it just needs to be unique.
42 
43 
45 
46  sgmm_.ComputePerFrameVars(data, (*gselect_)[frame], *spk_,
48  }
50  log_prune_);
51 }
52 
53 
54 } // namespace kaldi
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
kaldi::int32 int32
const std::vector< std::vector< int32 > > * gselect_
Sgmm2PerSpkDerivedVars * spk_
Sgmm2LikelihoodCache sgmm_cache_
BaseFloat LogLikelihood(const Sgmm2PerFrameDerivedVars &per_frame_vars, int32 j2, Sgmm2LikelihoodCache *cache, Sgmm2PerSpkDerivedVars *spk_vars, BaseFloat log_prune=0.0) const
This does a likelihood computation for a given state using the pre-selected Gaussian components (in p...
Definition: am-sgmm2.cc:517
Sgmm2PerFrameDerivedVars per_frame_vars_
const Matrix< BaseFloat > * feature_matrix_
virtual BaseFloat LogLikelihoodForPdf(int32 frame, int32 pdf_id)
void ComputePerFrameVars(const VectorBase< BaseFloat > &data, const std::vector< int32 > &gselect, const Sgmm2PerSpkDerivedVars &spk_vars, Sgmm2PerFrameDerivedVars *per_frame_vars) const
This needs to be called with each new frame of data, prior to accumulation or likelihood evaluation: ...
Definition: am-sgmm2.cc:442
Represents a non-allocating general vector which can be defined as a sub-vector of higher-level vecto...
Definition: kaldi-vector.h:501