DecodableAmNnet is a decodable object that decodes with a neural net acoustic model of type AmNnet. More...
#include <decodable-am-nnet.h>
Public Member Functions | |
DecodableAmNnet (const TransitionModel &trans_model, const AmNnet &am_nnet, const CuMatrixBase< BaseFloat > &feats, bool pad_input=true, BaseFloat prob_scale=1.0) | |
virtual BaseFloat | LogLikelihood (int32 frame, int32 transition_id) |
Returns the log likelihood, which will be negated in the decoder. More... | |
virtual 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... | |
Public Member Functions inherited from DecodableInterface | |
virtual | ~DecodableInterface () |
Protected Member Functions | |
KALDI_DISALLOW_COPY_AND_ASSIGN (DecodableAmNnet) | |
Protected Attributes | |
const TransitionModel & | trans_model_ |
Matrix< BaseFloat > | log_probs_ |
DecodableAmNnet is a decodable object that decodes with a neural net acoustic model of type AmNnet.
Definition at line 37 of file decodable-am-nnet.h.
|
inline |
Definition at line 39 of file decodable-am-nnet.h.
References AmNnet::GetNnet(), KALDI_ASSERT, KALDI_WARN, Nnet::LeftContext(), DecodableAmNnet::log_probs_, kaldi::nnet2::NnetComputation(), TransitionModel::NumPdfs(), CuMatrixBase< Real >::NumRows(), AmNnet::Priors(), Nnet::RightContext(), and Matrix< Real >::Swap().
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 87 of file decodable-am-nnet.h.
References KALDI_ASSERT, and DecodableAmNnet::NumFramesReady().
|
protected |
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.
Definition at line 77 of file decodable-am-nnet.h.
References DecodableAmNnet::log_probs_, DecodableAmNnet::trans_model_, and TransitionModel::TransitionIdToPdfFast().
Referenced by kaldi::nnet2::UnitTestNnetDecodable().
|
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 82 of file decodable-am-nnet.h.
References DecodableAmNnet::log_probs_, and MatrixBase< Real >::NumRows().
Referenced by DecodableAmNnet::IsLastFrame(), DecodableAmNnetParallel::IsLastFrame(), and kaldi::nnet2::UnitTestNnetDecodable().
|
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 85 of file decodable-am-nnet.h.
References TransitionModel::NumTransitionIds(), and DecodableAmNnet::trans_model_.
Definition at line 94 of file decodable-am-nnet.h.
Referenced by DecodableAmNnetParallel::Compute(), DecodableAmNnet::DecodableAmNnet(), DecodableAmNnet::LogLikelihood(), DecodableAmNnetParallel::LogLikelihood(), DecodableAmNnet::NumFramesReady(), and DecodableAmNnetParallel::NumFramesReady().
|
protected |
Definition at line 93 of file decodable-am-nnet.h.
Referenced by DecodableAmNnetParallel::Compute(), DecodableAmNnet::LogLikelihood(), DecodableAmNnetParallel::LogLikelihood(), DecodableAmNnet::NumIndices(), and DecodableAmNnetParallel::NumIndices().