#include <nnet-am-decodable-simple.h>
Public Member Functions | |
DecodableNnetSimple (const NnetSimpleComputationOptions &opts, const Nnet &nnet, const VectorBase< BaseFloat > &priors, const MatrixBase< BaseFloat > &feats, CachingOptimizingCompiler *compiler, const VectorBase< BaseFloat > *ivector=NULL, const MatrixBase< BaseFloat > *online_ivectors=NULL, int32 online_ivector_period=1) | |
This constructor takes features as input, and you can either supply a single iVector input, estimated in batch-mode ('ivector'), or 'online' iVectors ('online_ivectors' and 'online_ivector_period', or none at all. More... | |
int32 | NumFrames () const |
int32 | OutputDim () const |
void | GetOutputForFrame (int32 frame, VectorBase< BaseFloat > *output) |
BaseFloat | GetOutput (int32 subsampled_frame, int32 pdf_id) |
Private Member Functions | |
KALDI_DISALLOW_COPY_AND_ASSIGN (DecodableNnetSimple) | |
void | EnsureFrameIsComputed (int32 subsampled_frame) |
void | DoNnetComputation (int32 input_t_start, const MatrixBase< BaseFloat > &input_feats, const VectorBase< BaseFloat > &ivector, int32 output_t_start, int32 num_subsampled_frames) |
void | GetCurrentIvector (int32 output_t_start, int32 num_output_frames, Vector< BaseFloat > *ivector) |
void | CheckAndFixConfigs () |
int32 | GetIvectorDim () const |
Private Attributes | |
NnetSimpleComputationOptions | opts_ |
const Nnet & | nnet_ |
int32 | nnet_left_context_ |
int32 | nnet_right_context_ |
int32 | output_dim_ |
CuVector< BaseFloat > | log_priors_ |
const MatrixBase< BaseFloat > & | feats_ |
int32 | num_subsampled_frames_ |
const VectorBase< BaseFloat > * | ivector_ |
const MatrixBase< BaseFloat > * | online_ivector_feats_ |
int32 | online_ivector_period_ |
CachingOptimizingCompiler & | compiler_ |
Matrix< BaseFloat > | current_log_post_ |
int32 | current_log_post_subsampled_offset_ |
Definition at line 148 of file nnet-am-decodable-simple.h.
DecodableNnetSimple | ( | const NnetSimpleComputationOptions & | opts, |
const Nnet & | nnet, | ||
const VectorBase< BaseFloat > & | priors, | ||
const MatrixBase< BaseFloat > & | feats, | ||
CachingOptimizingCompiler * | compiler, | ||
const VectorBase< BaseFloat > * | ivector = NULL , |
||
const MatrixBase< BaseFloat > * | online_ivectors = NULL , |
||
int32 | online_ivector_period = 1 |
||
) |
This constructor takes features as input, and you can either supply a single iVector input, estimated in batch-mode ('ivector'), or 'online' iVectors ('online_ivectors' and 'online_ivector_period', or none at all.
Note: it stores references to all arguments to the constructor, so don't delete them till this goes out of scope.
[in] | opts | The options class. Warning: it includes an acoustic weight, whose default is 0.1; you may sometimes want to change this to 1.0. |
[in] | nnet | The neural net that we're going to do the computation with |
[in] | priors | Vector of priors– if supplied and nonempty, we subtract the log of these priors from the nnet output. |
[in] | feats | The input feature matrix. |
[in] | compiler | A pointer to the compiler object to use– this enables the user to maintain a common object in the calling code that will cache computations across decodes. Note: the compiler code has no locking mechanism (and it would be tricky to design one, as we'd need to lock the individual computations also), so the calling code has to make sure that if there are multiple threads, they do not share the same compiler object. |
[in] | ivector | If you are using iVectors estimated in batch mode, a pointer to the iVector, else NULL. |
[in] | online_ivectors | If you are using iVectors estimated 'online' a pointer to the iVectors, else NULL. |
[in] | online_ivector_period | If you are using iVectors estimated 'online' (i.e. if online_ivectors != NULL) gives the periodicity (in frames) with which the iVectors are estimated. |
Definition at line 27 of file nnet-am-decodable-simple.cc.
References DecodableNnetSimple::CheckAndFixConfigs(), DecodableNnetSimple::compiler_, DecodableNnetSimple::feats_, NnetSimpleComputationOptions::frame_subsampling_factor, CachingOptimizingCompiler::GetSimpleNnetContext(), kaldi::nnet3::IsSimpleNnet(), KALDI_ASSERT, DecodableNnetSimple::log_priors_, DecodableNnetSimple::nnet_left_context_, DecodableNnetSimple::nnet_right_context_, DecodableNnetSimple::num_subsampled_frames_, and DecodableNnetSimple::opts_.
|
private |
Definition at line 278 of file nnet-am-decodable-simple.cc.
References KALDI_ASSERT, KALDI_ERR, KALDI_LOG, kaldi::Lcm(), and rnnlm::n.
Referenced by DecodableNnetSimple::DecodableNnetSimple().
|
private |
Definition at line 215 of file nnet-am-decodable-simple.cc.
References NnetComputer::AcceptInput(), CuMatrixBase< Real >::AddVecToRows(), CachingOptimizingCompiler::Compile(), DecodableAmNnetSimple::compiler_, VectorBase< Real >::Dim(), NnetComputer::GetOutputDestructive(), IoSpecification::has_deriv, rnnlm::i, IoSpecification::indexes, ComputationRequest::inputs, IoSpecification::name, ComputationRequest::need_model_derivative, MatrixBase< Real >::NumRows(), ComputationRequest::outputs, CuMatrix< Real >::Resize(), CuMatrixBase< Real >::Row(), NnetComputer::Run(), CuMatrixBase< Real >::Scale(), ComputationRequest::store_component_stats, and CuMatrix< Real >::Swap().
|
private |
Definition at line 93 of file nnet-am-decodable-simple.cc.
References VectorBase< Real >::CopyFromVec(), rnnlm::i, KALDI_ASSERT, KALDI_ERR, and MatrixBase< Real >::NumRows().
|
private |
Definition at line 181 of file nnet-am-decodable-simple.cc.
References KALDI_ASSERT, and KALDI_ERR.
|
private |
Definition at line 84 of file nnet-am-decodable-simple.cc.
Definition at line 205 of file nnet-am-decodable-simple.h.
References NnetSimpleComputationOptions::CheckAndFixConfigs(), and KALDI_DISALLOW_COPY_AND_ASSIGN.
Referenced by DecodableAmNnetSimple::LogLikelihood(), and DecodableAmNnetSimpleParallel::LogLikelihood().
void GetOutputForFrame | ( | int32 | frame, |
VectorBase< BaseFloat > * | output | ||
) |
Definition at line 171 of file nnet-am-decodable-simple.cc.
References VectorBase< Real >::CopyFromVec().
Referenced by main(), and kaldi::nnet3::TestNnetDecodable().
|
private |
|
inline |
Definition at line 194 of file nnet-am-decodable-simple.h.
Referenced by main().
|
inline |
Definition at line 196 of file nnet-am-decodable-simple.h.
Referenced by main().
|
private |
Definition at line 271 of file nnet-am-decodable-simple.h.
Referenced by DecodableNnetSimple::DecodableNnetSimple().
Definition at line 275 of file nnet-am-decodable-simple.h.
|
private |
Definition at line 279 of file nnet-am-decodable-simple.h.
|
private |
Definition at line 253 of file nnet-am-decodable-simple.h.
Referenced by DecodableNnetSimple::DecodableNnetSimple().
|
private |
Definition at line 260 of file nnet-am-decodable-simple.h.
Definition at line 252 of file nnet-am-decodable-simple.h.
Referenced by DecodableNnetSimple::DecodableNnetSimple().
|
private |
Definition at line 247 of file nnet-am-decodable-simple.h.
|
private |
Definition at line 248 of file nnet-am-decodable-simple.h.
Referenced by DecodableNnetSimple::DecodableNnetSimple().
|
private |
Definition at line 249 of file nnet-am-decodable-simple.h.
Referenced by DecodableNnetSimple::DecodableNnetSimple().
|
private |
Definition at line 256 of file nnet-am-decodable-simple.h.
Referenced by DecodableNnetSimple::DecodableNnetSimple().
|
private |
Definition at line 263 of file nnet-am-decodable-simple.h.
|
private |
Definition at line 266 of file nnet-am-decodable-simple.h.
|
private |
Definition at line 246 of file nnet-am-decodable-simple.h.
Referenced by DecodableNnetSimple::DecodableNnetSimple().
|
private |
Definition at line 250 of file nnet-am-decodable-simple.h.