#include <transition-model.h>
Classes | |
struct | Tuple |
Public Member Functions | |
TransitionModel (const ContextDependencyInterface &ctx_dep, const HmmTopology &hmm_topo) | |
Initialize the object [e.g. More... | |
TransitionModel () | |
Constructor that takes no arguments: typically used prior to calling Read. More... | |
void | Read (std::istream &is, bool binary) |
void | Write (std::ostream &os, bool binary) const |
const HmmTopology & | GetTopo () const |
return reference to HMM-topology object. More... | |
bool | IsFinal (int32 trans_id) const |
bool | IsSelfLoop (int32 trans_id) const |
int32 | NumTransitionIds () const |
Returns the total number of transition-ids (note, these are one-based). More... | |
int32 | NumTransitionIndices (int32 trans_state) const |
Returns the number of transition-indices for a particular transition-state. More... | |
int32 | NumTransitionStates () const |
Returns the total number of transition-states (note, these are one-based). More... | |
int32 | NumPdfs () const |
int32 | NumPhones () const |
const std::vector< int32 > & | GetPhones () const |
Returns a sorted, unique list of phones. More... | |
BaseFloat | GetTransitionProb (int32 trans_id) const |
BaseFloat | GetTransitionLogProb (int32 trans_id) const |
BaseFloat | GetTransitionLogProbIgnoringSelfLoops (int32 trans_id) const |
Returns the log-probability of a particular non-self-loop transition after subtracting the probability mass of the self-loop and renormalizing; will crash if called on a self-loop. More... | |
BaseFloat | GetNonSelfLoopLogProb (int32 trans_state) const |
Returns the log-prob of the non-self-loop probability mass for this transition state. More... | |
void | MleUpdate (const Vector< double > &stats, const MleTransitionUpdateConfig &cfg, BaseFloat *objf_impr_out, BaseFloat *count_out) |
Does Maximum Likelihood estimation. More... | |
void | MapUpdate (const Vector< double > &stats, const MapTransitionUpdateConfig &cfg, BaseFloat *objf_impr_out, BaseFloat *count_out) |
Does Maximum A Posteriori (MAP) estimation. More... | |
void | Print (std::ostream &os, const std::vector< std::string > &phone_names, const Vector< double > *occs=NULL) |
Print will print the transition model in a human-readable way, for purposes of human inspection. More... | |
void | InitStats (Vector< double > *stats) const |
void | Accumulate (BaseFloat prob, int32 trans_id, Vector< double > *stats) const |
bool | Compatible (const TransitionModel &other) const |
returns true if all the integer class members are identical (but does not compare the transition probabilities. More... | |
Integer mapping functions | |
int32 | TupleToTransitionState (int32 phone, int32 hmm_state, int32 pdf, int32 self_loop_pdf) const |
int32 | PairToTransitionId (int32 trans_state, int32 trans_index) const |
int32 | TransitionIdToTransitionState (int32 trans_id) const |
int32 | TransitionIdToTransitionIndex (int32 trans_id) const |
int32 | TransitionStateToPhone (int32 trans_state) const |
int32 | TransitionStateToHmmState (int32 trans_state) const |
int32 | TransitionStateToForwardPdfClass (int32 trans_state) const |
int32 | TransitionStateToSelfLoopPdfClass (int32 trans_state) const |
int32 | TransitionStateToForwardPdf (int32 trans_state) const |
int32 | TransitionStateToSelfLoopPdf (int32 trans_state) const |
int32 | SelfLoopOf (int32 trans_state) const |
int32 | TransitionIdToPdf (int32 trans_id) const |
int32 | TransitionIdToPdfFast (int32 trans_id) const |
int32 | TransitionIdToPhone (int32 trans_id) const |
int32 | TransitionIdToPdfClass (int32 trans_id) const |
int32 | TransitionIdToHmmState (int32 trans_id) const |
Private Member Functions | |
void | MleUpdateShared (const Vector< double > &stats, const MleTransitionUpdateConfig &cfg, BaseFloat *objf_impr_out, BaseFloat *count_out) |
This version of the Update() function is for if the user specifies –share-for-pdfs=true. More... | |
void | MapUpdateShared (const Vector< double > &stats, const MapTransitionUpdateConfig &cfg, BaseFloat *objf_impr_out, BaseFloat *count_out) |
This version of the MapUpdate() function is for if the user specifies –share-for-pdfs=true. More... | |
void | ComputeTuples (const ContextDependencyInterface &ctx_dep) |
void | ComputeTuplesIsHmm (const ContextDependencyInterface &ctx_dep) |
void | ComputeTuplesNotHmm (const ContextDependencyInterface &ctx_dep) |
void | ComputeDerived () |
void | ComputeDerivedOfProbs () |
void | InitializeProbs () |
void | Check () const |
bool | IsHmm () const |
KALDI_DISALLOW_COPY_AND_ASSIGN (TransitionModel) | |
Private Attributes | |
HmmTopology | topo_ |
std::vector< Tuple > | tuples_ |
Tuples indexed by transition state minus one; the tuples are in sorted order which allows us to do the reverse mapping from tuple to transition state. More... | |
std::vector< int32 > | state2id_ |
Gives the first transition_id of each transition-state; indexed by the transition-state. More... | |
std::vector< int32 > | id2state_ |
For each transition-id, the corresponding transition state (indexed by transition-id). More... | |
std::vector< int32 > | id2pdf_id_ |
Vector< BaseFloat > | log_probs_ |
For each transition-id, the corresponding log-prob. Indexed by transition-id. More... | |
Vector< BaseFloat > | non_self_loop_log_probs_ |
For each transition-state, the log of (1 - self-loop-prob). More... | |
int32 | num_pdfs_ |
This is actually one plus the highest-numbered pdf we ever got back from the tree (but the tree numbers pdfs contiguously from zero so this is the number of pdfs). More... | |
Definition at line 123 of file transition-model.h.
TransitionModel | ( | const ContextDependencyInterface & | ctx_dep, |
const HmmTopology & | hmm_topo | ||
) |
Initialize the object [e.g.
at the start of training]. The class keeps a copy of the HmmTopology object, but not the ContextDependency object.
Definition at line 245 of file transition-model.cc.
References TransitionModel::Check(), TransitionModel::ComputeDerived(), TransitionModel::ComputeTuples(), and TransitionModel::InitializeProbs().
|
inline |
Constructor that takes no arguments: typically used prior to calling Read.
Definition at line 134 of file transition-model.h.
Definition at line 243 of file transition-model.h.
References KALDI_ASSERT.
Referenced by main().
|
private |
Definition at line 209 of file transition-model.cc.
References KALDI_ASSERT, TransitionModel::log_probs_, TransitionModel::NumTransitionIds(), TransitionModel::NumTransitionIndices(), TransitionModel::NumTransitionStates(), TransitionModel::PairToTransitionId(), TransitionModel::TransitionIdToTransitionIndex(), TransitionModel::TransitionIdToTransitionState(), TransitionModel::TransitionStateToForwardPdf(), TransitionModel::TransitionStateToHmmState(), TransitionModel::TransitionStateToPhone(), TransitionModel::TransitionStateToSelfLoopPdf(), and TransitionModel::TupleToTransitionState().
Referenced by TransitionModel::Read(), and TransitionModel::TransitionModel().
bool Compatible | ( | const TransitionModel & | other | ) | const |
returns true if all the integer class members are identical (but does not compare the transition probabilities.
Definition at line 906 of file transition-model.cc.
References TransitionModel::id2state_, TransitionModel::num_pdfs_, TransitionModel::state2id_, TransitionModel::topo_, and TransitionModel::tuples_.
Referenced by OnlineGmmDecodingModels::OnlineGmmDecodingModels(), and kaldi::TestTransitionModel().
|
private |
Definition at line 144 of file transition-model.cc.
References TransitionModel::id2pdf_id_, TransitionModel::id2state_, TransitionModel::IsSelfLoop(), TransitionModel::num_pdfs_, TransitionModel::state2id_, TransitionModel::topo_, HmmTopology::TopologyForPhone(), HmmTopology::HmmState::transitions, and TransitionModel::tuples_.
Referenced by TransitionModel::Read(), and TransitionModel::TransitionModel().
|
private |
Definition at line 375 of file transition-model.cc.
References kaldi::Exp(), TransitionModel::GetTransitionLogProb(), KALDI_WARN, kaldi::Log(), TransitionModel::non_self_loop_log_probs_, TransitionModel::NumTransitionStates(), and TransitionModel::SelfLoopOf().
Referenced by TransitionModel::InitializeProbs(), TransitionModel::MapUpdate(), TransitionModel::MapUpdateShared(), TransitionModel::MleUpdate(), TransitionModel::MleUpdateShared(), and TransitionModel::Read().
|
private |
Definition at line 27 of file transition-model.cc.
References TransitionModel::ComputeTuplesIsHmm(), TransitionModel::ComputeTuplesNotHmm(), TransitionModel::IsHmm(), and TransitionModel::tuples_.
Referenced by TransitionModel::TransitionModel().
|
private |
Definition at line 38 of file transition-model.cc.
References ContextDependencyInterface::GetPdfInfo(), HmmTopology::GetPhones(), rnnlm::i, rnnlm::j, KALDI_ASSERT, kaldi::kNoPdf, HmmTopology::NumPdfClasses(), TransitionModel::topo_, HmmTopology::TopologyForPhone(), and TransitionModel::tuples_.
Referenced by TransitionModel::ComputeTuples().
|
private |
Definition at line 82 of file transition-model.cc.
References ContextDependencyInterface::GetPdfInfo(), HmmTopology::GetPhones(), rnnlm::i, rnnlm::j, KALDI_ASSERT, kaldi::kNoPdf, TransitionModel::topo_, HmmTopology::TopologyForPhone(), and TransitionModel::tuples_.
Referenced by TransitionModel::ComputeTuples().
Returns the log-prob of the non-self-loop probability mass for this transition state.
(you can get the self-loop prob, if a self-loop exists, by calling GetTransitionLogProb(SelfLoopOf(trans_state)).
Definition at line 463 of file transition-model.cc.
References KALDI_ASSERT, and TransitionModel::non_self_loop_log_probs_.
Referenced by kaldi::AddSelfLoopsNoReorder(), kaldi::AddSelfLoopsReorder(), kaldi::GetScaledTransitionLogProb(), and TransitionModel::GetTransitionLogProbIgnoringSelfLoops().
|
inline |
Returns a sorted, unique list of phones.
Definition at line 199 of file transition-model.h.
References fst::Print().
Referenced by TrainingGraphCompiler::CompileGraph(), TrainingGraphCompiler::CompileGraphs(), kaldi::GetHTransducer(), main(), kaldi::TestSplitToPhones(), kaldi::TestWordAlignLatticeLexicon(), and TrainingGraphCompiler::TrainingGraphCompiler().
|
inline |
return reference to HMM-topology object.
Definition at line 141 of file transition-model.h.
Referenced by kaldi::ConvertAlignmentForPhone(), kaldi::ConvertAlignmentInternal(), kaldi::GenerateRandomAlignment(), kaldi::GetHmmAsFsa(), kaldi::GetHmmAsFsaSimple(), kaldi::GetIlabelMapping(), kaldi::GetRandomAlignmentForPhone(), main(), and kaldi::SplitToPhonesInternal().
Definition at line 459 of file transition-model.cc.
References TransitionModel::log_probs_.
Referenced by kaldi::AddSelfLoopsNoReorder(), kaldi::AddSelfLoopsReorder(), TransitionModel::ComputeDerivedOfProbs(), kaldi::GetHmmAsFsaSimple(), and kaldi::GetScaledTransitionLogProb().
Returns the log-probability of a particular non-self-loop transition after subtracting the probability mass of the self-loop and renormalizing; will crash if called on a self-loop.
Specifically: for non-self-loops it returns the log of (that prob divided by (1 minus self-loop-prob-for-that-state)).
Definition at line 468 of file transition-model.cc.
References TransitionModel::GetNonSelfLoopLogProb(), TransitionModel::IsSelfLoop(), KALDI_ASSERT, KALDI_PARANOID_ASSERT, TransitionModel::log_probs_, and TransitionModel::TransitionIdToTransitionState().
Referenced by kaldi::GetHmmAsFsa(), and kaldi::GetScaledTransitionLogProb().
Definition at line 455 of file transition-model.cc.
References kaldi::Exp(), and TransitionModel::log_probs_.
Referenced by TransitionModel::MapUpdate(), TransitionModel::MapUpdateShared(), TransitionModel::MleUpdate(), TransitionModel::MleUpdateShared(), and TransitionModel::Print().
|
private |
Definition at line 190 of file transition-model.cc.
References TransitionModel::ComputeDerivedOfProbs(), TransitionModel::Tuple::hmm_state, TransitionModel::id2state_, KALDI_ASSERT, KALDI_ERR, KALDI_WARN, kaldi::Log(), TransitionModel::log_probs_, TransitionModel::NumTransitionIds(), TransitionModel::Tuple::phone, TransitionModel::state2id_, TransitionModel::topo_, HmmTopology::TopologyForPhone(), and TransitionModel::tuples_.
Referenced by TransitionModel::TransitionModel().
|
inline |
Definition at line 241 of file transition-model.h.
References Vector< Real >::Resize().
Referenced by main().
Definition at line 342 of file transition-model.cc.
References TransitionModel::Tuple::hmm_state, TransitionModel::id2state_, KALDI_ASSERT, TransitionModel::Tuple::phone, TransitionModel::state2id_, TransitionModel::topo_, HmmTopology::TopologyForPhone(), and TransitionModel::tuples_.
Referenced by kaldi::ConvertCompactLatticeToPhones(), kaldi::IsPlausibleWord(), LatticePhoneAligner::ComputationState::OutputArcForce(), LatticeWordAligner::ComputationState::OutputArcForce(), LatticeWordAligner::ComputationState::OutputNormalWordArc(), LatticeWordAligner::ComputationState::OutputOnePhoneWordArc(), LatticePhoneAligner::ComputationState::OutputPhoneArc(), ArcPosteriorComputer::OutputPosteriors(), LatticeWordAligner::ComputationState::OutputSilenceArc(), kaldi::SplitToPhonesInternal(), WordAlignedLatticeTester::TestArcNormalWord(), WordAlignedLatticeTester::TestArcOnePhoneWord(), and WordAlignedLatticeTester::TestArcSilence().
|
private |
Definition at line 231 of file transition-model.cc.
References HmmTopology::GetPhones(), rnnlm::i, rnnlm::j, KALDI_ASSERT, TransitionModel::topo_, and HmmTopology::TopologyForPhone().
Referenced by TransitionModel::ComputeTuples(), TransitionModel::MapUpdateShared(), TransitionModel::MleUpdateShared(), TransitionModel::Print(), and TransitionModel::Write().
Definition at line 912 of file transition-model.cc.
References TransitionModel::Tuple::hmm_state, TransitionModel::id2state_, KALDI_ASSERT, TransitionModel::Tuple::phone, TransitionModel::state2id_, TransitionModel::topo_, HmmTopology::TopologyForPhone(), and TransitionModel::tuples_.
Referenced by kaldi::ChangeReorderingOfAlignment(), TransitionModel::ComputeDerived(), kaldi::ConvertLatticeToPhones(), fst::DeterminizeLatticeInsertPhones(), kaldi::GetScaledTransitionLogProb(), TransitionModel::GetTransitionLogProbIgnoringSelfLoops(), kaldi::IsPlausibleWord(), kaldi::IsReordered(), LatticeWordAligner::ComputationState::OutputArcForce(), LatticeWordAligner::ComputationState::OutputNormalWordArc(), LatticeWordAligner::ComputationState::OutputOnePhoneWordArc(), LatticePhoneAligner::ComputationState::OutputPhoneArc(), LatticeWordAligner::ComputationState::OutputSilenceArc(), TransitionModel::Print(), kaldi::SplitToPhonesInternal(), WordAlignedLatticeTester::TestArcNormalWord(), and TransitionModel::TransitionIdToPdfClass().
|
private |
void MapUpdate | ( | const Vector< double > & | stats, |
const MapTransitionUpdateConfig & | cfg, | ||
BaseFloat * | objf_impr_out, | ||
BaseFloat * | count_out | ||
) |
Does Maximum A Posteriori (MAP) estimation.
The stats are counts/weights, indexed by transition-id.
Definition at line 541 of file transition-model.cc.
References TransitionModel::ComputeDerivedOfProbs(), VectorBase< Real >::Dim(), TransitionModel::GetTransitionProb(), KALDI_ASSERT, KALDI_ERR, KALDI_LOG, kaldi::Log(), TransitionModel::log_probs_, TransitionModel::MapUpdateShared(), rnnlm::n, TransitionModel::NumTransitionIds(), TransitionModel::NumTransitionIndices(), TransitionModel::NumTransitionStates(), TransitionModel::PairToTransitionId(), MapTransitionUpdateConfig::share_for_pdfs, VectorBase< Real >::Sum(), and MapTransitionUpdateConfig::tau.
Referenced by main().
|
private |
This version of the MapUpdate() function is for if the user specifies –share-for-pdfs=true.
We share the transitions for all states that share the same pdf.
Definition at line 698 of file transition-model.cc.
References TransitionModel::ComputeDerivedOfProbs(), VectorBase< Real >::Dim(), TransitionModel::GetTransitionProb(), TransitionModel::IsHmm(), KALDI_ASSERT, KALDI_ERR, KALDI_LOG, kaldi::Log(), TransitionModel::log_probs_, rnnlm::n, TransitionModel::NumTransitionIds(), TransitionModel::NumTransitionIndices(), TransitionModel::NumTransitionStates(), TransitionModel::PairToTransitionId(), MapTransitionUpdateConfig::share_for_pdfs, VectorBase< Real >::Sum(), MapTransitionUpdateConfig::tau, TransitionModel::TransitionStateToForwardPdf(), and TransitionModel::TransitionStateToSelfLoopPdf().
Referenced by TransitionModel::MapUpdate().
void MleUpdate | ( | const Vector< double > & | stats, |
const MleTransitionUpdateConfig & | cfg, | ||
BaseFloat * | objf_impr_out, | ||
BaseFloat * | count_out | ||
) |
Does Maximum Likelihood estimation.
The stats are counts/weights, indexed by transition-id. This was previously called Update().
Definition at line 475 of file transition-model.cc.
References TransitionModel::ComputeDerivedOfProbs(), VectorBase< Real >::Dim(), MleTransitionUpdateConfig::floor, TransitionModel::GetTransitionProb(), rnnlm::i, KALDI_ASSERT, KALDI_ERR, KALDI_LOG, kaldi::Log(), TransitionModel::log_probs_, MleTransitionUpdateConfig::mincount, TransitionModel::MleUpdateShared(), rnnlm::n, TransitionModel::NumTransitionIds(), TransitionModel::NumTransitionIndices(), TransitionModel::NumTransitionStates(), TransitionModel::PairToTransitionId(), VectorBase< Real >::Scale(), MleTransitionUpdateConfig::share_for_pdfs, and VectorBase< Real >::Sum().
Referenced by main().
|
private |
This version of the Update() function is for if the user specifies –share-for-pdfs=true.
We share the transitions for all states that share the same pdf.
Definition at line 599 of file transition-model.cc.
References TransitionModel::ComputeDerivedOfProbs(), VectorBase< Real >::Dim(), MleTransitionUpdateConfig::floor, TransitionModel::GetTransitionProb(), rnnlm::i, TransitionModel::IsHmm(), KALDI_ASSERT, KALDI_ERR, KALDI_LOG, kaldi::Log(), TransitionModel::log_probs_, MleTransitionUpdateConfig::mincount, rnnlm::n, TransitionModel::NumTransitionIds(), TransitionModel::NumTransitionIndices(), TransitionModel::NumTransitionStates(), TransitionModel::PairToTransitionId(), VectorBase< Real >::Scale(), MleTransitionUpdateConfig::share_for_pdfs, VectorBase< Real >::Sum(), TransitionModel::TransitionStateToForwardPdf(), and TransitionModel::TransitionStateToSelfLoopPdf().
Referenced by TransitionModel::MleUpdate().
|
inline |
Definition at line 190 of file transition-model.h.
Referenced by DecodableMatrixMappedOffset::AcceptLoglikes(), DecodableAmNnetParallel::Compute(), DecodableAmNnet::DecodableAmNnet(), DecodableDiagGmmScaledOnline::DecodableDiagGmmScaledOnline(), DecodableMatrixMapped::DecodableMatrixMapped(), DecodableMatrixScaledMapped::DecodableMatrixScaledMapped(), DecodableNnet2Online::DecodableNnet2Online(), kaldi::GetPdfToPhonesMap(), DiscriminativeComputation::LookupNnetOutput(), main(), OnlineDecodableDiagGmmScaled::OnlineDecodableDiagGmmScaled(), kaldi::PosteriorToPdfMatrix(), TransitionModel::Print(), kaldi::nnet3::SetPriors(), kaldi::nnet2::SetPriors(), kaldi::nnet2::UnitTestAmNnet(), kaldi::nnet2::UnitTestNnetDecodable(), and kaldi::nnet2::UpdateHash().
int32 NumPhones | ( | ) | const |
Definition at line 331 of file transition-model.cc.
References rnnlm::i, and TransitionModel::tuples_.
Referenced by main().
|
inline |
Returns the total number of transition-ids (note, these are one-based).
Definition at line 175 of file transition-model.h.
Referenced by kaldi::AddTransitionProbs(), TransitionModel::Check(), kaldi::GetHTransducer(), kaldi::GetPdfToPhonesMap(), kaldi::GetPdfToTransitionIdTransducer(), TransitionModel::InitializeProbs(), kaldi::LatticeBoost(), main(), TransitionModel::MapUpdate(), TransitionModel::MapUpdateShared(), TransitionModel::MleUpdate(), TransitionModel::MleUpdateShared(), OnlineDecodableDiagGmmScaled::NumIndices(), DecodableDiagGmmScaledOnline::NumIndices(), DecodableAmDiagGmmRegtreeFmllr::NumIndices(), DecodableAmSgmm2::NumIndices(), DecodableMatrixScaledMapped::NumIndices(), DecodableAmNnet::NumIndices(), DecodableAmDiagGmmRegtreeMllr::NumIndices(), DecodableMatrixMapped::NumIndices(), DecodableAmNnetParallel::NumIndices(), DecodableMatrixMappedOffset::NumIndices(), and kaldi::nnet2::UnitTestNnetDecodable().
Returns the number of transition-indices for a particular transition-state.
Note: "Indices" is the plural of "index". Index is not the same as "id", here. A transition-index is a zero-based offset into the transitions out of a particular transition state.
Definition at line 270 of file transition-model.cc.
References KALDI_ASSERT, TransitionModel::state2id_, and TransitionModel::tuples_.
Referenced by TransitionModel::Check(), main(), TransitionModel::MapUpdate(), TransitionModel::MapUpdateShared(), TransitionModel::MleUpdate(), TransitionModel::MleUpdateShared(), and TransitionModel::Print().
|
inline |
Returns the total number of transition-states (note, these are one-based).
Definition at line 184 of file transition-model.h.
Referenced by TransitionModel::Check(), TransitionModel::ComputeDerivedOfProbs(), kaldi::GetPdfsForPhones(), kaldi::GetPhonesForPdfs(), main(), TransitionModel::MapUpdate(), TransitionModel::MapUpdateShared(), TransitionModel::MleUpdate(), TransitionModel::MleUpdateShared(), and TransitionModel::Print().
Definition at line 325 of file transition-model.cc.
References KALDI_ASSERT, TransitionModel::state2id_, and TransitionModel::tuples_.
Referenced by TransitionModel::Check(), kaldi::ConvertAlignmentForPhone(), kaldi::GenerateRandomAlignment(), kaldi::GetHmmAsFsa(), kaldi::GetHmmAsFsaSimple(), TransitionModel::MapUpdate(), TransitionModel::MapUpdateShared(), TransitionModel::MleUpdate(), TransitionModel::MleUpdateShared(), TransitionModel::Print(), and TransitionModel::SelfLoopOf().
void Print | ( | std::ostream & | os, |
const std::vector< std::string > & | phone_names, | ||
const Vector< double > * | occs = NULL |
||
) |
Print will print the transition model in a human-readable way, for purposes of human inspection.
The "occs" are optional (they are indexed by pdf-id).
Definition at line 812 of file transition-model.cc.
References VectorBase< Real >::Dim(), TransitionModel::Tuple::forward_pdf, TransitionModel::GetTransitionProb(), TransitionModel::Tuple::hmm_state, TransitionModel::IsHmm(), TransitionModel::IsSelfLoop(), KALDI_ASSERT, TransitionModel::NumPdfs(), TransitionModel::NumTransitionIndices(), TransitionModel::NumTransitionStates(), TransitionModel::PairToTransitionId(), TransitionModel::Tuple::phone, TransitionModel::Tuple::self_loop_pdf, TransitionModel::topo_, HmmTopology::TopologyForPhone(), and TransitionModel::tuples_.
Referenced by main().
void Read | ( | std::istream & | is, |
bool | binary | ||
) |
Definition at line 394 of file transition-model.cc.
References TransitionModel::Check(), TransitionModel::ComputeDerived(), TransitionModel::ComputeDerivedOfProbs(), kaldi::ExpectToken(), rnnlm::i, KALDI_ASSERT, TransitionModel::log_probs_, HmmTopology::Read(), kaldi::ReadBasicType(), kaldi::ReadToken(), TransitionModel::topo_, and TransitionModel::tuples_.
Referenced by kaldi::InitAmGmmFromOld(), main(), OnlineGmmDecodingModels::OnlineGmmDecodingModels(), Nnet::Read(), and kaldi::TestTransitionModel().
Definition at line 360 of file transition-model.cc.
References KALDI_ASSERT, TransitionModel::PairToTransitionId(), TransitionModel::topo_, HmmTopology::TopologyForPhone(), and TransitionModel::tuples_.
Referenced by kaldi::AddSelfLoopsNoReorder(), kaldi::AddSelfLoopsReorder(), and TransitionModel::ComputeDerivedOfProbs().
Definition at line 805 of file transition-model.cc.
References TransitionModel::Tuple::hmm_state, TransitionModel::id2state_, KALDI_ASSERT, and TransitionModel::tuples_.
Referenced by kaldi::ConvertAlignmentForPhone(), kaldi::ConvertLatticeToPhones(), and fst::DeterminizeLatticeInsertPhones().
Definition at line 791 of file transition-model.cc.
References TransitionModel::Tuple::hmm_state, TransitionModel::id2state_, TransitionModel::IsSelfLoop(), KALDI_ASSERT, TransitionModel::Tuple::phone, TransitionModel::topo_, HmmTopology::TopologyForPhone(), and TransitionModel::tuples_.
Referenced by kaldi::AccumulateTreeStats().
Definition at line 785 of file transition-model.cc.
References TransitionModel::id2state_, KALDI_ASSERT, and TransitionModel::tuples_.
Referenced by kaldi::AccumulateTreeStats(), LatticeLexiconWordAligner::ComputationState::Advance(), kaldi::CompactLatticeToWordProns(), kaldi::ConvertAlignmentForPhone(), kaldi::ConvertAlignmentInternal(), kaldi::ConvertCompactLatticeToPhones(), kaldi::ConvertLatticeToPhones(), kaldi::ConvertPosteriorToPhones(), fst::DeterminizeLatticeInsertPhones(), OnlineFasterDecoder::EndOfUtterance(), OnlineSilenceWeighting::GetDeltaWeights(), kaldi::GetPdfToPhonesMap(), kaldi::IsPlausibleWord(), kaldi::LatticeActivePhones(), kaldi::LatticeBoost(), kaldi::LatticeForwardBackwardMpeVariants(), main(), LatticePhoneAligner::ComputationState::OutputArcForce(), LatticeWordAligner::ComputationState::OutputArcForce(), LatticeWordAligner::ComputationState::OutputNormalWordArc(), LatticeWordAligner::ComputationState::OutputOnePhoneWordArc(), LatticePhoneAligner::ComputationState::OutputPhoneArc(), ArcPosteriorComputer::OutputPosteriors(), LatticeWordAligner::ComputationState::OutputSilenceArc(), WordAlignedLatticeTester::TestArcNormalWord(), WordAlignedLatticeTester::TestArcOnePhoneWord(), WordAlignedLatticeTester::TestArcSilence(), kaldi::TestConvertAlignment(), kaldi::TestSplitToPhones(), kaldi::TrailingSilenceLength(), kaldi::WeightSilencePost(), and kaldi::WeightSilencePostDistributed().
Definition at line 280 of file transition-model.cc.
References TransitionModel::id2state_, KALDI_ASSERT, and TransitionModel::state2id_.
Referenced by TransitionModel::Check(), and kaldi::ConvertAlignmentForPhone().
Definition at line 275 of file transition-model.cc.
References TransitionModel::id2state_, and KALDI_ASSERT.
Referenced by kaldi::ChangeReorderingOfAlignment(), TransitionModel::Check(), kaldi::ConvertAlignmentForPhone(), kaldi::GetScaledTransitionLogProb(), TransitionModel::GetTransitionLogProbIgnoringSelfLoops(), kaldi::IsReordered(), main(), kaldi::SplitToPhonesInternal(), WordAlignedLatticeTester::TestArcNormalWord(), WordAlignedLatticeTester::TestArcOnePhoneWord(), and WordAlignedLatticeTester::TestArcSilence().
Definition at line 290 of file transition-model.cc.
References KALDI_ASSERT, and TransitionModel::tuples_.
Referenced by TransitionModel::Check(), kaldi::GetPdfsForPhones(), kaldi::GetPhonesForPdfs(), TransitionModel::MapUpdateShared(), and TransitionModel::MleUpdateShared().
Definition at line 295 of file transition-model.cc.
References KALDI_ASSERT, TransitionModel::topo_, HmmTopology::TopologyForPhone(), and TransitionModel::tuples_.
Referenced by kaldi::ConvertAlignmentForPhone().
Definition at line 320 of file transition-model.cc.
References KALDI_ASSERT, and TransitionModel::tuples_.
Referenced by TransitionModel::Check(), and kaldi::SplitToPhonesInternal().
Definition at line 285 of file transition-model.cc.
References KALDI_ASSERT, and TransitionModel::tuples_.
Referenced by TransitionModel::Check(), kaldi::GetPdfsForPhones(), kaldi::GetPhonesForPdfs(), main(), and kaldi::SplitToPhonesInternal().
Definition at line 315 of file transition-model.cc.
References KALDI_ASSERT, and TransitionModel::tuples_.
Referenced by TransitionModel::Check(), kaldi::GetPdfsForPhones(), kaldi::GetPhonesForPdfs(), TransitionModel::MapUpdateShared(), and TransitionModel::MleUpdateShared().
Definition at line 305 of file transition-model.cc.
References KALDI_ASSERT, TransitionModel::topo_, HmmTopology::TopologyForPhone(), and TransitionModel::tuples_.
Referenced by kaldi::ConvertAlignmentForPhone().
Definition at line 254 of file transition-model.cc.
References KALDI_ERR, and TransitionModel::tuples_.
Referenced by TransitionModel::Check(), kaldi::ConvertAlignmentForPhone(), kaldi::GenerateRandomAlignment(), kaldi::GetHmmAsFsa(), and kaldi::GetHmmAsFsaSimple().
void Write | ( | std::ostream & | os, |
bool | binary | ||
) | const |
Definition at line 422 of file transition-model.cc.
References rnnlm::i, TransitionModel::IsHmm(), TransitionModel::log_probs_, TransitionModel::topo_, TransitionModel::tuples_, HmmTopology::Write(), kaldi::WriteBasicType(), and kaldi::WriteToken().
Referenced by main(), and kaldi::TestTransitionModel().
|
private |
Definition at line 310 of file transition-model.h.
Referenced by TransitionModel::ComputeDerived().
|
private |
For each transition-id, the corresponding transition state (indexed by transition-id).
Definition at line 308 of file transition-model.h.
Referenced by TransitionModel::Compatible(), TransitionModel::ComputeDerived(), TransitionModel::InitializeProbs(), TransitionModel::IsFinal(), TransitionModel::IsSelfLoop(), TransitionModel::TransitionIdToHmmState(), TransitionModel::TransitionIdToPdfClass(), TransitionModel::TransitionIdToPhone(), TransitionModel::TransitionIdToTransitionIndex(), and TransitionModel::TransitionIdToTransitionState().
For each transition-id, the corresponding log-prob. Indexed by transition-id.
Definition at line 313 of file transition-model.h.
Referenced by TransitionModel::Check(), TransitionModel::GetTransitionLogProb(), TransitionModel::GetTransitionLogProbIgnoringSelfLoops(), TransitionModel::GetTransitionProb(), TransitionModel::InitializeProbs(), TransitionModel::MapUpdate(), TransitionModel::MapUpdateShared(), TransitionModel::MleUpdate(), TransitionModel::MleUpdateShared(), TransitionModel::Read(), and TransitionModel::Write().
For each transition-state, the log of (1 - self-loop-prob).
Indexed by transition-state.
Definition at line 317 of file transition-model.h.
Referenced by TransitionModel::ComputeDerivedOfProbs(), and TransitionModel::GetNonSelfLoopLogProb().
|
private |
This is actually one plus the highest-numbered pdf we ever got back from the tree (but the tree numbers pdfs contiguously from zero so this is the number of pdfs).
Definition at line 322 of file transition-model.h.
Referenced by TransitionModel::Compatible(), and TransitionModel::ComputeDerived().
|
private |
Gives the first transition_id of each transition-state; indexed by the transition-state.
Array indexed 1..num-transition-states+1 (the last one is needed so we can know the num-transitions of the last transition-state.
Definition at line 304 of file transition-model.h.
Referenced by TransitionModel::Compatible(), TransitionModel::ComputeDerived(), TransitionModel::InitializeProbs(), TransitionModel::IsFinal(), TransitionModel::IsSelfLoop(), TransitionModel::NumTransitionIndices(), TransitionModel::PairToTransitionId(), and TransitionModel::TransitionIdToTransitionIndex().
|
private |
Definition at line 294 of file transition-model.h.
Referenced by TransitionModel::Compatible(), TransitionModel::ComputeDerived(), TransitionModel::ComputeTuplesIsHmm(), TransitionModel::ComputeTuplesNotHmm(), TransitionModel::InitializeProbs(), TransitionModel::IsFinal(), TransitionModel::IsHmm(), TransitionModel::IsSelfLoop(), TransitionModel::Print(), TransitionModel::Read(), TransitionModel::SelfLoopOf(), TransitionModel::TransitionIdToPdfClass(), TransitionModel::TransitionStateToForwardPdfClass(), TransitionModel::TransitionStateToSelfLoopPdfClass(), and TransitionModel::Write().
|
private |
Tuples indexed by transition state minus one; the tuples are in sorted order which allows us to do the reverse mapping from tuple to transition state.
Definition at line 299 of file transition-model.h.
Referenced by TransitionModel::Compatible(), TransitionModel::ComputeDerived(), TransitionModel::ComputeTuples(), TransitionModel::ComputeTuplesIsHmm(), TransitionModel::ComputeTuplesNotHmm(), TransitionModel::InitializeProbs(), TransitionModel::IsFinal(), TransitionModel::IsSelfLoop(), TransitionModel::NumPhones(), TransitionModel::NumTransitionIndices(), TransitionModel::PairToTransitionId(), TransitionModel::Print(), TransitionModel::Read(), TransitionModel::SelfLoopOf(), TransitionModel::TransitionIdToHmmState(), TransitionModel::TransitionIdToPdfClass(), TransitionModel::TransitionIdToPhone(), TransitionModel::TransitionStateToForwardPdf(), TransitionModel::TransitionStateToForwardPdfClass(), TransitionModel::TransitionStateToHmmState(), TransitionModel::TransitionStateToPhone(), TransitionModel::TransitionStateToSelfLoopPdf(), TransitionModel::TransitionStateToSelfLoopPdfClass(), TransitionModel::TupleToTransitionState(), and TransitionModel::Write().