This version of DecodableAmNnet is intended for a version of the decoder that processes different utterances with multiple threads. More...
#include <decodable-am-nnet.h>
Public Member Functions | |
DecodableAmNnetParallel (const TransitionModel &trans_model, const AmNnet &am_nnet, const CuMatrix< BaseFloat > *feats, bool pad_input=true, BaseFloat prob_scale=1.0) | |
void | Compute () |
virtual BaseFloat | LogLikelihood (int32 frame, int32 transition_id) |
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... | |
~DecodableAmNnetParallel () | |
Public Member Functions inherited from DecodableInterface | |
virtual | ~DecodableInterface () |
Protected Member Functions | |
KALDI_DISALLOW_COPY_AND_ASSIGN (DecodableAmNnetParallel) | |
Protected Attributes | |
const TransitionModel & | trans_model_ |
const AmNnet & | am_nnet_ |
CuMatrix< BaseFloat > | log_probs_ |
const CuMatrix< BaseFloat > * | feats_ |
bool | pad_input_ |
BaseFloat | prob_scale_ |
This version of DecodableAmNnet is intended for a version of the decoder that processes different utterances with multiple threads.
It needs to do the computation in a different place than the initializer, since the initializer gets called in the main thread of the program.
Definition at line 105 of file decodable-am-nnet.h.
|
inline |
Definition at line 107 of file decodable-am-nnet.h.
References KALDI_ASSERT.
|
inline |
Definition at line 166 of file decodable-am-nnet.h.
|
inline |
Definition at line 118 of file decodable-am-nnet.h.
References MatrixBase< Real >::AddVecToRows(), MatrixBase< Real >::ApplyFloor(), MatrixBase< Real >::ApplyLog(), KALDI_ASSERT, DecodableAmNnet::log_probs_, kaldi::nnet2::NnetComputation(), TransitionModel::NumPdfs(), Matrix< Real >::Resize(), MatrixBase< Real >::Scale(), and DecodableAmNnet::trans_model_.
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 162 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 139 of file decodable-am-nnet.h.
References DecodableAmNnet::log_probs_, DecodableAmNnet::trans_model_, and TransitionModel::TransitionIdToPdfFast().
|
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 145 of file decodable-am-nnet.h.
References DecodableAmNnet::log_probs_, and MatrixBase< Real >::NumRows().
|
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 160 of file decodable-am-nnet.h.
References TransitionModel::NumTransitionIds(), and DecodableAmNnet::trans_model_.
|
protected |
Definition at line 171 of file decodable-am-nnet.h.
Definition at line 174 of file decodable-am-nnet.h.
Definition at line 172 of file decodable-am-nnet.h.
|
protected |
Definition at line 175 of file decodable-am-nnet.h.
|
protected |
Definition at line 176 of file decodable-am-nnet.h.
|
protected |
Definition at line 170 of file decodable-am-nnet.h.