#include <decodable-am-sgmm2.h>
Public Member Functions | |
DecodableAmSgmm2 (const AmSgmm2 &sgmm, const TransitionModel &tm, const Matrix< BaseFloat > &feats, const std::vector< std::vector< int32 > > &gselect, BaseFloat log_prune, Sgmm2PerSpkDerivedVars *spk) | |
DecodableAmSgmm2 (const AmSgmm2 &sgmm, const TransitionModel &tm, const Matrix< BaseFloat > *feats, const std::vector< std::vector< int32 > > *gselect, Sgmm2PerSpkDerivedVars *spk, BaseFloat log_prune) | |
This version of the constructor takes ownership of the pointers "feats", "gselect" and "spk", and will delete them when it is destroyed. More... | |
virtual BaseFloat | LogLikelihood (int32 frame, int32 tid) |
Returns the log likelihood, which will be negated in the decoder. More... | |
int32 | NumFramesReady () const |
The call NumFramesReady() will return the number of frames currently available for this decodable object. More... | |
virtual int32 | NumIndices () const |
Returns the number of states in the acoustic model (they will be indexed one-based, i.e. More... | |
virtual bool | IsLastFrame (int32 frame) const |
Returns true if this is the last frame. More... | |
virtual | ~DecodableAmSgmm2 () |
Public Member Functions inherited from DecodableInterface | |
virtual | ~DecodableInterface () |
Protected Member Functions | |
virtual BaseFloat | LogLikelihoodForPdf (int32 frame, int32 pdf_id) |
Protected Attributes | |
const AmSgmm2 & | sgmm_ |
Sgmm2PerSpkDerivedVars * | spk_ |
const TransitionModel & | trans_model_ |
for tid to pdf mapping More... | |
const Matrix< BaseFloat > * | feature_matrix_ |
const std::vector< std::vector< int32 > > * | gselect_ |
BaseFloat | log_prune_ |
int32 | cur_frame_ |
Sgmm2PerFrameDerivedVars | per_frame_vars_ |
Sgmm2LikelihoodCache | sgmm_cache_ |
bool | delete_vars_ |
Private Member Functions | |
KALDI_DISALLOW_COPY_AND_ASSIGN (DecodableAmSgmm2) | |
Definition at line 33 of file decodable-am-sgmm2.h.
|
inline |
Definition at line 35 of file decodable-am-sgmm2.h.
References KALDI_ASSERT, and MatrixBase< Real >::NumRows().
|
inline |
This version of the constructor takes ownership of the pointers "feats", "gselect" and "spk", and will delete them when it is destroyed.
Definition at line 50 of file decodable-am-sgmm2.h.
References KALDI_ASSERT, and MatrixBase< Real >::NumRows().
|
virtual |
Definition at line 29 of file decodable-am-sgmm2.cc.
References DecodableAmSgmm2::delete_vars_, DecodableAmSgmm2::feature_matrix_, DecodableAmSgmm2::gselect_, and DecodableAmSgmm2::spk_.
Referenced by DecodableAmSgmm2::IsLastFrame().
Returns true if this is the last frame.
Frames are zero-based, so the first frame is zero. IsLastFrame(-1) will return false, unless the file is empty (which is a case that I'm not sure all the code will handle, so be careful). Caution: the behavior of this function in an online setting is being changed somewhat. In future it may return false in cases where we haven't yet decided to terminate decoding, but later true if we decide to terminate decoding. The plan in future is to rely more on NumFramesReady(), and in future, IsLastFrame() would always return false in an online-decoding setting, and would only return true in a decoding-from-matrix setting where we want to allow the last delta or LDA features to be flushed out for compatibility with the baseline setup.
Implements DecodableInterface.
Definition at line 71 of file decodable-am-sgmm2.h.
References KALDI_ASSERT, DecodableAmSgmm2::LogLikelihoodForPdf(), DecodableAmSgmm2::NumFramesReady(), and DecodableAmSgmm2::~DecodableAmSgmm2().
|
private |
Returns the log likelihood, which will be negated in the decoder.
The "frame" starts from zero. You should verify that NumFramesReady() > frame before calling this.
Implements DecodableInterface.
Reimplemented in DecodableAmSgmm2Scaled.
Definition at line 65 of file decodable-am-sgmm2.h.
References DecodableAmSgmm2::LogLikelihoodForPdf(), DecodableAmSgmm2::trans_model_, and TransitionModel::TransitionIdToPdfFast().
Definition at line 37 of file decodable-am-sgmm2.cc.
References AmSgmm2::ComputePerFrameVars(), DecodableAmSgmm2::cur_frame_, DecodableAmSgmm2::feature_matrix_, DecodableAmSgmm2::gselect_, DecodableAmSgmm2::log_prune_, AmSgmm2::LogLikelihood(), Sgmm2LikelihoodCache::NextFrame(), DecodableAmSgmm2::per_frame_vars_, DecodableAmSgmm2::sgmm_, DecodableAmSgmm2::sgmm_cache_, and DecodableAmSgmm2::spk_.
Referenced by DecodableAmSgmm2::IsLastFrame(), DecodableAmSgmm2::LogLikelihood(), and DecodableAmSgmm2Scaled::LogLikelihood().
|
inlinevirtual |
The call NumFramesReady() will return the number of frames currently available for this decodable object.
This is for use in setups where you don't want the decoder to block while waiting for input. This is newly added as of Jan 2014, and I hope, going forward, to rely on this mechanism more than IsLastFrame to know when to stop decoding.
Reimplemented from DecodableInterface.
Definition at line 68 of file decodable-am-sgmm2.h.
References DecodableAmSgmm2::feature_matrix_, and MatrixBase< Real >::NumRows().
Referenced by DecodableAmSgmm2::IsLastFrame().
|
inlinevirtual |
Returns the number of states in the acoustic model (they will be indexed one-based, i.e.
from 1 to NumIndices(); this is for compatibility with OpenFst).
Implements DecodableInterface.
Definition at line 69 of file decodable-am-sgmm2.h.
References TransitionModel::NumTransitionIds(), and DecodableAmSgmm2::trans_model_.
|
protected |
Definition at line 88 of file decodable-am-sgmm2.h.
Referenced by DecodableAmSgmm2::LogLikelihoodForPdf().
|
protected |
Definition at line 92 of file decodable-am-sgmm2.h.
Referenced by DecodableAmSgmm2::~DecodableAmSgmm2().
Definition at line 83 of file decodable-am-sgmm2.h.
Referenced by DecodableAmSgmm2::LogLikelihoodForPdf(), DecodableAmSgmm2::NumFramesReady(), and DecodableAmSgmm2::~DecodableAmSgmm2().
|
protected |
Definition at line 84 of file decodable-am-sgmm2.h.
Referenced by DecodableAmSgmm2::LogLikelihoodForPdf(), and DecodableAmSgmm2::~DecodableAmSgmm2().
|
protected |
Definition at line 86 of file decodable-am-sgmm2.h.
Referenced by DecodableAmSgmm2::LogLikelihoodForPdf().
|
protected |
Definition at line 89 of file decodable-am-sgmm2.h.
Referenced by DecodableAmSgmm2::LogLikelihoodForPdf().
|
protected |
Definition at line 80 of file decodable-am-sgmm2.h.
Referenced by DecodableAmSgmm2::LogLikelihoodForPdf().
|
protected |
Definition at line 90 of file decodable-am-sgmm2.h.
Referenced by DecodableAmSgmm2::LogLikelihoodForPdf().
|
protected |
Definition at line 81 of file decodable-am-sgmm2.h.
Referenced by DecodableAmSgmm2::LogLikelihoodForPdf(), and DecodableAmSgmm2::~DecodableAmSgmm2().
|
protected |
for tid to pdf mapping
Definition at line 82 of file decodable-am-sgmm2.h.
Referenced by DecodableAmSgmm2::LogLikelihood(), DecodableAmSgmm2Scaled::LogLikelihood(), and DecodableAmSgmm2::NumIndices().