#include <fmpe.h>
Public Member Functions | |
Fmpe () | |
Fmpe (const DiagGmm &gmm, const FmpeOptions &config) | |
int32 | FeatDim () const |
int32 | NumGauss () const |
int32 | NumContexts () const |
int32 | ProjectionTNumRows () const |
int32 | ProjectionTNumCols () const |
void | ComputeFeatures (const MatrixBase< BaseFloat > &feat_in, const std::vector< std::vector< int32 > > &gselect, Matrix< BaseFloat > *feat_out) const |
void | AccStats (const MatrixBase< BaseFloat > &feat_in, const std::vector< std::vector< int32 > > &gselect, const MatrixBase< BaseFloat > &direct_feat_deriv, const MatrixBase< BaseFloat > *indirect_feat_deriv, FmpeStats *stats) const |
void | Write (std::ostream &os, bool binary) const |
void | Read (std::istream &is, bool binary) |
BaseFloat | Update (const FmpeUpdateOptions &config, const FmpeStats &stats) |
Private Member Functions | |
void | SetContexts (std::string context_str) |
void | ComputeC () |
void | ComputeStddevs () |
void | ApplyProjection (const MatrixBase< BaseFloat > &feat_in, const std::vector< std::vector< int32 > > &gselect, MatrixBase< BaseFloat > *intermed_feat) const |
void | ApplyProjectionReverse (const MatrixBase< BaseFloat > &feat_in, const std::vector< std::vector< int32 > > &gselect, const MatrixBase< BaseFloat > &intermed_feat_deriv, MatrixBase< BaseFloat > *proj_deriv_plus, MatrixBase< BaseFloat > *proj_deriv_minus) const |
void | ApplyContext (const MatrixBase< BaseFloat > &intermed_feat, MatrixBase< BaseFloat > *feat_out) const |
void | ApplyContextReverse (const MatrixBase< BaseFloat > &feat_deriv, MatrixBase< BaseFloat > *intermed_feat_deriv) const |
void | ApplyC (MatrixBase< BaseFloat > *feat_out, bool reverse=false) const |
void | ApplyCReverse (MatrixBase< BaseFloat > *deriv) const |
Private Attributes | |
DiagGmm | gmm_ |
FmpeOptions | config_ |
Matrix< BaseFloat > | stddevs_ |
Matrix< BaseFloat > | projT_ |
TpMatrix< BaseFloat > | C_ |
std::vector< std::vector< std::pair< int32, BaseFloat > > > | contexts_ |
Fmpe | ( | const DiagGmm & | gmm, |
const FmpeOptions & | config | ||
) |
Definition at line 435 of file fmpe.cc.
References Fmpe::ComputeC(), Fmpe::ComputeStddevs(), FmpeOptions::context_expansion, Fmpe::FeatDim(), Fmpe::NumContexts(), Fmpe::NumGauss(), Fmpe::projT_, Matrix< Real >::Resize(), and Fmpe::SetContexts().
void AccStats | ( | const MatrixBase< BaseFloat > & | feat_in, |
const std::vector< std::vector< int32 > > & | gselect, | ||
const MatrixBase< BaseFloat > & | direct_feat_deriv, | ||
const MatrixBase< BaseFloat > * | indirect_feat_deriv, | ||
FmpeStats * | stats | ||
) | const |
Definition at line 395 of file fmpe.cc.
References FmpeStats::AccumulateChecks(), MatrixBase< Real >::AddMat(), Fmpe::ApplyContextReverse(), Fmpe::ApplyCReverse(), Fmpe::ApplyProjectionReverse(), FmpeStats::DerivMinus(), FmpeStats::DerivPlus(), Fmpe::FeatDim(), KALDI_ASSERT, MatrixBase< Real >::NumCols(), Fmpe::NumContexts(), MatrixBase< Real >::NumRows(), Fmpe::projT_, and kaldi::SameDim().
Referenced by main(), and kaldi::TestFmpe().
|
private |
Definition at line 161 of file fmpe.cc.
References Fmpe::C_, VectorBase< Real >::CopyFromVec(), kaldi::kNoTrans, kaldi::kTrans, MatrixBase< Real >::NumCols(), and MatrixBase< Real >::NumRows().
Referenced by Fmpe::ComputeFeatures().
|
private |
Definition at line 97 of file fmpe.cc.
References Fmpe::contexts_, Fmpe::FeatDim(), rnnlm::i, rnnlm::j, KALDI_ASSERT, MatrixBase< Real >::NumCols(), Fmpe::NumContexts(), MatrixBase< Real >::NumRows(), and MatrixBase< Real >::Row().
Referenced by Fmpe::ComputeFeatures().
|
private |
Definition at line 126 of file fmpe.cc.
References Fmpe::contexts_, Fmpe::FeatDim(), rnnlm::i, rnnlm::j, KALDI_ASSERT, MatrixBase< Real >::NumCols(), Fmpe::NumContexts(), MatrixBase< Real >::NumRows(), and MatrixBase< Real >::Row().
Referenced by Fmpe::AccStats().
|
inlineprivate |
Definition at line 218 of file fmpe.h.
Referenced by Fmpe::AccStats().
|
private |
Definition at line 182 of file fmpe.cc.
References MatrixBase< Real >::AddMatMat(), VectorBase< Real >::AddMatVec(), VectorBase< Real >::AddVec(), VectorBase< Real >::ApplySoftMax(), Fmpe::config_, VectorBase< Real >::Dim(), Fmpe::FeatDim(), Fmpe::gmm_, rnnlm::i, rnnlm::j, kaldi::kNoTrans, kaldi::kTrans, DiagGmm::LogLikelihoodsPreselect(), DiagGmm::means_invvars(), Fmpe::NumContexts(), MatrixBase< Real >::NumRows(), FmpeOptions::post_scale, Fmpe::projT_, VectorBase< Real >::Range(), MatrixBase< Real >::Range(), MatrixBase< Real >::Row(), and Fmpe::stddevs_.
Referenced by Fmpe::ComputeFeatures().
|
private |
Definition at line 302 of file fmpe.cc.
References kaldi::AddOuterProductPlusMinus(), VectorBase< Real >::ApplySoftMax(), Fmpe::config_, VectorBase< Real >::Dim(), Fmpe::FeatDim(), Fmpe::gmm_, rnnlm::i, DiagGmm::LogLikelihoodsPreselect(), DiagGmm::means_invvars(), Fmpe::NumContexts(), MatrixBase< Real >::NumRows(), FmpeOptions::post_scale, VectorBase< Real >::Range(), MatrixBase< Real >::Row(), and Fmpe::stddevs_.
Referenced by Fmpe::AccStats().
|
private |
Definition at line 57 of file fmpe.cc.
References SpMatrix< Real >::AddDiagVec(), VectorBase< Real >::AddVec(), SpMatrix< Real >::AddVec2(), Fmpe::C_, TpMatrix< Real >::Cholesky(), DiagGmm::Dim(), Fmpe::gmm_, KALDI_ASSERT, KALDI_ERR, DiagGmmNormal::means_, DiagGmmNormal::NumGauss(), DiagGmm::NumGauss(), MatrixBase< Real >::Row(), PackedMatrix< Real >::Scale(), VectorBase< Real >::Scale(), DiagGmmNormal::vars_, and DiagGmmNormal::weights_.
Referenced by Fmpe::Fmpe().
void ComputeFeatures | ( | const MatrixBase< BaseFloat > & | feat_in, |
const std::vector< std::vector< int32 > > & | gselect, | ||
Matrix< BaseFloat > * | feat_out | ||
) | const |
Definition at line 370 of file fmpe.cc.
References Fmpe::ApplyC(), Fmpe::ApplyContext(), Fmpe::ApplyProjection(), Fmpe::FeatDim(), KALDI_ASSERT, MatrixBase< Real >::NumCols(), Fmpe::NumContexts(), MatrixBase< Real >::NumRows(), and Matrix< Real >::Resize().
Referenced by main(), and kaldi::TestFmpe().
|
private |
Definition at line 89 of file fmpe.cc.
References MatrixBase< Real >::ApplyPow(), MatrixBase< Real >::CopyFromMat(), Fmpe::gmm_, DiagGmm::inv_vars(), MatrixBase< Real >::NumCols(), MatrixBase< Real >::NumRows(), Matrix< Real >::Resize(), and Fmpe::stddevs_.
Referenced by Fmpe::Fmpe(), and Fmpe::Read().
|
inline |
Definition at line 143 of file fmpe.h.
Referenced by Fmpe::AccStats(), Fmpe::ApplyContext(), Fmpe::ApplyContextReverse(), Fmpe::ApplyProjection(), Fmpe::ApplyProjectionReverse(), Fmpe::ComputeFeatures(), Fmpe::Fmpe(), and FmpeStats::Init().
|
inline |
Definition at line 145 of file fmpe.h.
Referenced by Fmpe::AccStats(), Fmpe::ApplyContext(), Fmpe::ApplyContextReverse(), Fmpe::ApplyProjection(), Fmpe::ApplyProjectionReverse(), Fmpe::ComputeFeatures(), and Fmpe::Fmpe().
|
inline |
Definition at line 144 of file fmpe.h.
Referenced by Fmpe::Fmpe().
|
inline |
Definition at line 152 of file fmpe.h.
References FmpeOptions::Read(), and FmpeOptions::Write().
Referenced by FmpeStats::Init().
|
inline |
void Read | ( | std::istream & | is, |
bool | binary | ||
) |
Definition at line 512 of file fmpe.cc.
References Fmpe::C_, Fmpe::ComputeStddevs(), Fmpe::config_, FmpeOptions::context_expansion, Fmpe::gmm_, Fmpe::projT_, FmpeOptions::Read(), DiagGmm::Read(), Matrix< Real >::Read(), and Fmpe::SetContexts().
Referenced by kaldi::TestFmpe().
|
private |
Definition at line 29 of file fmpe.cc.
References Fmpe::contexts_, kaldi::ConvertStringToInteger(), kaldi::ConvertStringToReal(), rnnlm::i, rnnlm::j, KALDI_ASSERT, KALDI_ERR, and kaldi::SplitStringToVector().
Referenced by Fmpe::Fmpe(), and Fmpe::Read().
BaseFloat Update | ( | const FmpeUpdateOptions & | config, |
const FmpeStats & | stats | ||
) |
Definition at line 443 of file fmpe.cc.
References FmpeStats::DerivMinus(), FmpeStats::DerivPlus(), rnnlm::i, rnnlm::j, KALDI_ASSERT, KALDI_LOG, FmpeUpdateOptions::l2_weight, FmpeUpdateOptions::learning_rate, MatrixBase< Real >::Min(), rnnlm::n, MatrixBase< Real >::NumCols(), MatrixBase< Real >::NumRows(), Fmpe::projT_, and kaldi::SameDim().
Referenced by main(), and kaldi::TestFmpe().
void Write | ( | std::ostream & | os, |
bool | binary | ||
) | const |
Definition at line 500 of file fmpe.cc.
References Fmpe::C_, Fmpe::config_, Fmpe::gmm_, KALDI_ERR, DiagGmm::NumGauss(), Fmpe::projT_, FmpeOptions::Write(), DiagGmm::Write(), and MatrixBase< Real >::Write().
Referenced by main(), and kaldi::TestFmpe().
Definition at line 232 of file fmpe.h.
Referenced by Fmpe::ApplyC(), Fmpe::ComputeC(), Fmpe::Read(), and Fmpe::Write().
|
private |
Definition at line 223 of file fmpe.h.
Referenced by Fmpe::ApplyProjection(), Fmpe::ApplyProjectionReverse(), Fmpe::Read(), and Fmpe::Write().
Definition at line 242 of file fmpe.h.
Referenced by Fmpe::ApplyContext(), Fmpe::ApplyContextReverse(), and Fmpe::SetContexts().
|
private |
Definition at line 222 of file fmpe.h.
Referenced by Fmpe::ApplyProjection(), Fmpe::ApplyProjectionReverse(), Fmpe::ComputeC(), Fmpe::ComputeStddevs(), Fmpe::Read(), and Fmpe::Write().
Definition at line 228 of file fmpe.h.
Referenced by Fmpe::AccStats(), Fmpe::ApplyProjection(), Fmpe::Fmpe(), Fmpe::Read(), Fmpe::Update(), and Fmpe::Write().
Definition at line 224 of file fmpe.h.
Referenced by Fmpe::ApplyProjection(), Fmpe::ApplyProjectionReverse(), and Fmpe::ComputeStddevs().