All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes and functions related to HMM topology and transition modeling
Collaboration diagram for Classes and functions related to HMM topology and transition modeling:

Modules

 Classes and functions for creating FSTs from HMMs
 

Classes

class  HmmTopology
 A class for storing topology information for phones. More...
 
struct  HmmTopology::HmmState
 A structure defined inside HmmTopology to represent a HMM state. More...
 
struct  MleTransitionUpdateConfig
 
struct  MapTransitionUpdateConfig
 
class  TransitionModel
 
struct  TransitionModel::Tuple
 

Functions

bool SplitToPhones (const TransitionModel &trans_model, const std::vector< int32 > &alignment, std::vector< std::vector< int32 > > *split_alignment)
 SplitToPhones splits up the TransitionIds in "alignment" into their individual phones (one vector per instance of a phone). More...
 
bool ConvertAlignment (const TransitionModel &old_trans_model, const TransitionModel &new_trans_model, const ContextDependencyInterface &new_ctx_dep, const std::vector< int32 > &old_alignment, int32 subsample_factor,bool reorder, const std::vector< int32 > *phone_map,std::vector< int32 > *new_alignment)
 ConvertAlignment converts an alignment that was created using one model, to another model. More...
 
bool ConvertPhnxToProns (const std::vector< int32 > &phnx, const std::vector< int32 > &words, int32 word_start_sym, int32 word_end_sym, std::vector< std::vector< int32 > > *prons)
 
void GetRandomAlignmentForPhone (const ContextDependencyInterface &ctx_dep, const TransitionModel &trans_model, const std::vector< int32 > &phone_window, std::vector< int32 > *alignment)
 
void ChangeReorderingOfAlignment (const TransitionModel &trans_model, std::vector< int32 > *alignment)
 
bool GetPdfsForPhones (const TransitionModel &trans_model, const std::vector< int32 > &phones, std::vector< int32 > *pdfs)
 Works out which pdfs might correspond to the given phones. More...
 
bool GetPhonesForPdfs (const TransitionModel &trans_model, const std::vector< int32 > &pdfs, std::vector< int32 > *phones)
 Works out which phones might correspond to the given pdfs. More...
 

Variables

static const int32 kNoPdf = -1
 A constant used in the HmmTopology class as the pdf-class kNoPdf, which is used when a HMM-state is nonemitting (has no associated PDF). More...
 

Integer mapping functions

int32 TransitionIdToPdf (int32 trans_id) const
 

Detailed Description

Function Documentation

void ChangeReorderingOfAlignment ( const TransitionModel &  trans_model,
std::vector< int32 > *  alignment 
)

Definition at line 1134 of file hmm-utils.cc.

References TransitionModel::IsSelfLoop(), kaldi::swap(), and TransitionModel::TransitionIdToTransitionState().

Referenced by kaldi::ConvertAlignmentForPhone().

1135  {
1136  int32 start_pos = 0, size = alignment->size();
1137  while (start_pos != size) {
1138  int32 start_tid = (*alignment)[start_pos];
1139  int32 cur_tstate = trans_model.TransitionIdToTransitionState(start_tid);
1140  bool start_is_self_loop = trans_model.IsSelfLoop(start_tid) ? 0 : 1;
1141  int32 end_pos = start_pos + 1;
1142  // If the first instance of this transition-state was a self-loop, then eat
1143  // only non-self-loops of this state; if it was a non-self-loop, then eat
1144  // only self-loops of this state. Imposing this condition on self-loops
1145  // would only actually matter in the rare circumstances that phones can
1146  // have length 1.
1147  while (end_pos != size &&
1148  trans_model.TransitionIdToTransitionState((*alignment)[end_pos]) ==
1149  cur_tstate) {
1150  bool this_is_self_loop = trans_model.IsSelfLoop((*alignment)[end_pos]);
1151  if (!this_is_self_loop) {
1152  if (start_is_self_loop) {
1153  break; // stop before including this transition-id.
1154  } else {
1155  end_pos++;
1156  break; // stop after including this transition-id.
1157  }
1158  }
1159  end_pos++;
1160  }
1161  std::swap((*alignment)[start_pos], (*alignment)[end_pos - 1]);
1162  start_pos = end_pos;
1163  }
1164 }
void swap(basic_filebuf< CharT, Traits > &x, basic_filebuf< CharT, Traits > &y)
bool ConvertAlignment ( const TransitionModel &  old_trans_model,
const TransitionModel &  new_trans_model,
const ContextDependencyInterface &  new_ctx_dep,
const std::vector< int32 > &  old_alignment,
int32  subsample_factor,
bool  reorder,
const std::vector< int32 > *  phone_map,
std::vector< int32 > *  new_alignment 
)

ConvertAlignment converts an alignment that was created using one model, to another model.

Returns false if it could not be split to phones (e.g. because the alignment was partial), or because some other error happened, such as we couldn't convert the alignment because there were too few frames for the new topology.

Parameters
old_trans_model[in] The transition model that the original alignment used.
new_trans_model[in] The transition model that we want to use for the new alignment.
new_ctx_dep[in] The new tree
old_alignment[in] The alignment we want to convert
subsample_factor[in] The frame subsampling factor... normally 1, but might be > 1 if we're converting to a reduced-frame-rate system.
reorder[in] True if you want the pdf-ids on the new alignment to be 'reordered'. (vs. the way they appear in the HmmTopology object)
phone_map[in] If non-NULL, map from old to new phones.
new_alignment[out] The converted alignment.

Definition at line 853 of file hmm-utils.cc.

References ContextDependencyInterface::CentralPosition(), kaldi::ComputeNewPhoneLengths(), ContextDependencyInterface::ContextWidth(), kaldi::ConvertAlignmentForPhone(), TransitionModel::GetTopo(), rnnlm::i, kaldi::IsReordered(), KALDI_ASSERT, KALDI_ERR, KALDI_WARN, kaldi::SplitToPhones(), and TransitionModel::TransitionIdToPhone().

Referenced by main(), and kaldi::TestConvertAlignment().

860  {
861  bool old_is_reordered = IsReordered(old_trans_model, old_alignment);
862  KALDI_ASSERT(new_alignment != NULL);
863  new_alignment->clear();
864  new_alignment->reserve(old_alignment.size());
865  std::vector<std::vector<int32> > old_split; // split into phones.
866  if (!SplitToPhones(old_trans_model, old_alignment, &old_split))
867  return false;
868  int32 phone_sequence_length = old_split.size();
869  std::vector<int32> mapped_phones(phone_sequence_length);
870  for (size_t i = 0; i < phone_sequence_length; i++) {
871  KALDI_ASSERT(!old_split[i].empty());
872  mapped_phones[i] = old_trans_model.TransitionIdToPhone(old_split[i][0]);
873  if (phone_map != NULL) { // Map the phone sequence.
874  int32 sz = phone_map->size();
875  if (mapped_phones[i] < 0 || mapped_phones[i] >= sz ||
876  (*phone_map)[mapped_phones[i]] == -1)
877  KALDI_ERR << "ConvertAlignment: could not map phone " << mapped_phones[i];
878  mapped_phones[i] = (*phone_map)[mapped_phones[i]];
879  }
880  }
881 
882  // the sizes of each element of 'new_split' indicate the length of alignment
883  // that we want for each phone in the new sequence.
884  std::vector<std::vector<int32> > new_split(phone_sequence_length);
885  if (subsample_factor == 1 &&
886  old_trans_model.GetTopo() == new_trans_model.GetTopo()) {
887  // we know the old phone lengths will be fine.
888  for (size_t i = 0; i < phone_sequence_length; i++)
889  new_split[i].resize(old_split[i].size());
890  } else {
891  // .. they may not be fine.
892  std::vector<int32> old_lengths(phone_sequence_length), new_lengths;
893  for (int32 i = 0; i < phone_sequence_length; i++)
894  old_lengths[i] = old_split[i].size();
895  if (!ComputeNewPhoneLengths(new_trans_model.GetTopo(),
896  mapped_phones, old_lengths,
897  subsample_factor, &new_lengths)) {
898  KALDI_WARN << "Failed to produce suitable phone lengths";
899  return false;
900  }
901  for (int32 i = 0; i < phone_sequence_length; i++)
902  new_split[i].resize(new_lengths[i]);
903  }
904 
905  int32 N = new_ctx_dep.ContextWidth(),
906  P = new_ctx_dep.CentralPosition();
907 
908  // by starting at -N and going to phone_sequence_length + N, we're
909  // being generous and not bothering to work out the exact
910  // array bounds.
911  for (int32 win_start = -N;
912  win_start < static_cast<int32>(phone_sequence_length + N);
913  win_start++) { // start of a context window.
914  int32 central_pos = win_start + P;
915  if (static_cast<size_t>(central_pos) < phone_sequence_length) {
916  // i.e. if (central_pos >= 0 && central_pos < phone_sequence_length)
917  std::vector<int32> new_phone_window(N, 0);
918  for (int32 offset = 0; offset < N; offset++)
919  if (static_cast<size_t>(win_start+offset) < phone_sequence_length)
920  new_phone_window[offset] = mapped_phones[win_start+offset];
921  const std::vector<int32> &old_alignment_for_phone = old_split[central_pos];
922  std::vector<int32> &new_alignment_for_phone = new_split[central_pos];
923 
924  ConvertAlignmentForPhone(old_trans_model, new_trans_model, new_ctx_dep,
925  old_alignment_for_phone, new_phone_window,
926  old_is_reordered, new_is_reordered,
927  &new_alignment_for_phone);
928  new_alignment->insert(new_alignment->end(),
929  new_alignment_for_phone.begin(),
930  new_alignment_for_phone.end());
931  }
932  }
933  KALDI_ASSERT(new_alignment->size() ==
934  (old_alignment.size() + subsample_factor - 1)/subsample_factor);
935  return true;
936 }
static bool IsReordered(const TransitionModel &trans_model, const std::vector< int32 > &alignment)
Definition: hmm-utils.cc:579
bool SplitToPhones(const TransitionModel &trans_model, const std::vector< int32 > &alignment, std::vector< std::vector< int32 > > *split_alignment)
SplitToPhones splits up the TransitionIds in "alignment" into their individual phones (one vector per...
Definition: hmm-utils.cc:677
#define KALDI_ERR
Definition: kaldi-error.h:127
#define KALDI_WARN
Definition: kaldi-error.h:130
static void ConvertAlignmentForPhone(const TransitionModel &old_trans_model, const TransitionModel &new_trans_model, const ContextDependencyInterface &new_ctx_dep, const std::vector< int32 > &old_phone_alignment, const std::vector< int32 > &new_phone_window, bool old_is_reordered, bool new_is_reordered, std::vector< int32 > *new_phone_alignment)
This function is used internally inside ConvertAlignment; it converts the alignment for a single phon...
Definition: hmm-utils.cc:696
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:169
static bool ComputeNewPhoneLengths(const HmmTopology &topology, const std::vector< int32 > &mapped_phones, const std::vector< int32 > &old_lengths, int32 subsample_factor, std::vector< int32 > *new_lengths)
This function, called from ConvertAlignment(), works out suitable new lengths of phones in the case w...
Definition: hmm-utils.cc:784
bool ConvertPhnxToProns ( const std::vector< int32 > &  phnx,
const std::vector< int32 > &  words,
int32  word_start_sym,
int32  word_end_sym,
std::vector< std::vector< int32 > > *  prons 
)

Definition at line 1035 of file hmm-utils.cc.

References rnnlm::i, and rnnlm::j.

Referenced by main(), and kaldi::TestConvertPhnxToProns().

1039  {
1040  size_t i = 0, j = 0;
1041 
1042  while (i < phnx.size()) {
1043  if (phnx[i] == 0) return false; // zeros not valid here.
1044  if (phnx[i] == word_start_sym) { // start a word...
1045  std::vector<int32> pron;
1046  if (j >= words.size()) return false; // no word left..
1047  if (words[j] == 0) return false; // zero word disallowed.
1048  pron.push_back(words[j++]);
1049  i++;
1050  while (i < phnx.size()) {
1051  if (phnx[i] == 0) return false;
1052  if (phnx[i] == word_start_sym) return false; // error.
1053  if (phnx[i] == word_end_sym) { i++; break; }
1054  pron.push_back(phnx[i]);
1055  i++;
1056  }
1057  // check we did see the word-end symbol.
1058  if (!(i > 0 && phnx[i-1] == word_end_sym))
1059  return false;
1060  prons->push_back(pron);
1061  } else if (phnx[i] == word_end_sym) {
1062  return false; // error.
1063  } else {
1064  // start a non-word sequence of phones (e.g. opt-sil).
1065  std::vector<int32> pron;
1066  pron.push_back(0); // 0 serves as the word-id.
1067  while (i < phnx.size()) {
1068  if (phnx[i] == 0) return false;
1069  if (phnx[i] == word_start_sym) break;
1070  if (phnx[i] == word_end_sym) return false; // error.
1071  pron.push_back(phnx[i]);
1072  i++;
1073  }
1074  prons->push_back(pron);
1075  }
1076  }
1077  return (j == words.size());
1078 }
int32 words[kMaxOrder]
bool GetPdfsForPhones ( const TransitionModel &  trans_model,
const std::vector< int32 > &  phones,
std::vector< int32 > *  pdfs 
)

Works out which pdfs might correspond to the given phones.

Will return true if these pdfs correspond *just* to these phones, false if these pdfs are also used by other phones.

Parameters
trans_model[in] Transition-model used to work out this information
phones[in] A sorted, uniq vector that represents a set of phones
pdfs[out] Will be set to a sorted, uniq list of pdf-ids that correspond to one of this set of phones.
Returns
Returns true if all of the pdfs output to "pdfs" correspond to phones from just this set (false if they may be shared with phones outside this set).

Definition at line 843 of file transition-model.cc.

References kaldi::IsSortedAndUniq(), KALDI_ASSERT, TransitionModel::NumTransitionStates(), kaldi::SortAndUniq(), TransitionModel::TransitionStateToForwardPdf(), TransitionModel::TransitionStateToPhone(), and TransitionModel::TransitionStateToSelfLoopPdf().

Referenced by main().

845  {
846  KALDI_ASSERT(IsSortedAndUniq(phones));
847  KALDI_ASSERT(pdfs != NULL);
848  pdfs->clear();
849  for (int32 tstate = 1; tstate <= trans_model.NumTransitionStates(); tstate++) {
850  if (std::binary_search(phones.begin(), phones.end(),
851  trans_model.TransitionStateToPhone(tstate))) {
852  pdfs->push_back(trans_model.TransitionStateToForwardPdf(tstate));
853  pdfs->push_back(trans_model.TransitionStateToSelfLoopPdf(tstate));
854  }
855  }
856  SortAndUniq(pdfs);
857 
858  for (int32 tstate = 1; tstate <= trans_model.NumTransitionStates(); tstate++)
859  if ((std::binary_search(pdfs->begin(), pdfs->end(),
860  trans_model.TransitionStateToForwardPdf(tstate)) ||
861  std::binary_search(pdfs->begin(), pdfs->end(),
862  trans_model.TransitionStateToSelfLoopPdf(tstate)))
863  && !std::binary_search(phones.begin(), phones.end(),
864  trans_model.TransitionStateToPhone(tstate)))
865  return false;
866  return true;
867 }
void SortAndUniq(std::vector< T > *vec)
Sorts and uniq's (removes duplicates) from a vector.
Definition: stl-utils.h:39
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:169
bool IsSortedAndUniq(const std::vector< T > &vec)
Returns true if the vector is sorted and contains each element only once.
Definition: stl-utils.h:63
bool GetPhonesForPdfs ( const TransitionModel &  trans_model,
const std::vector< int32 > &  pdfs,
std::vector< int32 > *  phones 
)

Works out which phones might correspond to the given pdfs.

Similar to the above GetPdfsForPhones(, ,)

Definition at line 869 of file transition-model.cc.

References kaldi::IsSortedAndUniq(), KALDI_ASSERT, TransitionModel::NumTransitionStates(), kaldi::SortAndUniq(), TransitionModel::TransitionStateToForwardPdf(), TransitionModel::TransitionStateToPhone(), and TransitionModel::TransitionStateToSelfLoopPdf().

Referenced by kaldi::InitAmGmm().

871  {
873  KALDI_ASSERT(phones != NULL);
874  phones->clear();
875  for (int32 tstate = 1; tstate <= trans_model.NumTransitionStates(); tstate++) {
876  if (std::binary_search(pdfs.begin(), pdfs.end(),
877  trans_model.TransitionStateToForwardPdf(tstate)) ||
878  std::binary_search(pdfs.begin(), pdfs.end(),
879  trans_model.TransitionStateToSelfLoopPdf(tstate)))
880  phones->push_back(trans_model.TransitionStateToPhone(tstate));
881  }
882  SortAndUniq(phones);
883 
884  for (int32 tstate = 1; tstate <= trans_model.NumTransitionStates(); tstate++)
885  if (std::binary_search(phones->begin(), phones->end(),
886  trans_model.TransitionStateToPhone(tstate))
887  && !(std::binary_search(pdfs.begin(), pdfs.end(),
888  trans_model.TransitionStateToForwardPdf(tstate)) &&
889  std::binary_search(pdfs.begin(), pdfs.end(),
890  trans_model.TransitionStateToSelfLoopPdf(tstate))) )
891  return false;
892  return true;
893 }
void SortAndUniq(std::vector< T > *vec)
Sorts and uniq's (removes duplicates) from a vector.
Definition: stl-utils.h:39
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:169
bool IsSortedAndUniq(const std::vector< T > &vec)
Returns true if the vector is sorted and contains each element only once.
Definition: stl-utils.h:63
void GetRandomAlignmentForPhone ( const ContextDependencyInterface &  ctx_dep,
const TransitionModel &  trans_model,
const std::vector< int32 > &  phone_window,
std::vector< int32 > *  alignment 
)

Definition at line 1081 of file hmm-utils.cc.

References ContextDependencyInterface::CentralPosition(), kaldi::GetHmmAsFstSimple(), fst::GetInputSymbols(), TransitionModel::GetTopo(), rnnlm::i, rnnlm::j, KALDI_ASSERT, KALDI_ERR, and HmmTopology::MinLength().

Referenced by kaldi::ConvertAlignmentForPhone().

1084  {
1085  typedef fst::StdArc Arc;
1086  int32 length = alignment->size();
1087  BaseFloat prob_scale = 0.0;
1088  fst::VectorFst<Arc> *fst = GetHmmAsFstSimple(phone_window, ctx_dep,
1089  trans_model, prob_scale);
1090  fst::RmEpsilon(fst);
1091 
1092  fst::VectorFst<Arc> length_constraint_fst;
1093  { // set up length_constraint_fst.
1094  std::vector<int32> symbols;
1095  bool include_epsilon = false;
1096  // note: 'fst' is an acceptor so ilabels == olabels.
1097  GetInputSymbols(*fst, include_epsilon, &symbols);
1098  int32 cur_state = length_constraint_fst.AddState();
1099  length_constraint_fst.SetStart(cur_state);
1100  for (int32 i = 0; i < length; i++) {
1101  int32 next_state = length_constraint_fst.AddState();
1102  for (size_t j = 0; j < symbols.size(); j++) {
1103  length_constraint_fst.AddArc(cur_state,
1104  Arc(symbols[j], symbols[j],
1105  fst::TropicalWeight::One(),
1106  next_state));
1107  }
1108  cur_state = next_state;
1109  }
1110  length_constraint_fst.SetFinal(cur_state, fst::TropicalWeight::One());
1111  }
1112  fst::VectorFst<Arc> composed_fst;
1113  fst::Compose(*fst, length_constraint_fst, &composed_fst);
1114  fst::VectorFst<Arc> single_path_fst;
1115  { // randomly generate a single path.
1116  fst::UniformArcSelector<Arc> selector;
1117  fst::RandGenOptions<fst::UniformArcSelector<Arc> > randgen_opts(selector);
1118  fst::RandGen(composed_fst, &single_path_fst, randgen_opts);
1119  }
1120  if (single_path_fst.NumStates() == 0) {
1121  KALDI_ERR << "Error generating random alignment (wrong length?): "
1122  << "requested length is " << length << " versus min-length "
1123  << trans_model.GetTopo().MinLength(
1124  phone_window[ctx_dep.CentralPosition()]);
1125  }
1126  std::vector<int32> symbol_sequence;
1127  bool ans = fst::GetLinearSymbolSequence<Arc, int32>(
1128  single_path_fst, &symbol_sequence, NULL, NULL);
1129  KALDI_ASSERT(ans && symbol_sequence.size() == length);
1130  symbol_sequence.swap(*alignment);
1131  delete fst;
1132 }
Definition: graph.dox:21
fst::StdArc StdArc
void GetInputSymbols(const Fst< Arc > &fst, bool include_eps, vector< I > *symbols)
GetInputSymbols gets the list of symbols on the input of fst (including epsilon, if include_eps == tr...
float BaseFloat
Definition: kaldi-types.h:29
#define KALDI_ERR
Definition: kaldi-error.h:127
fst::VectorFst< fst::StdArc > * GetHmmAsFstSimple(std::vector< int32 > phone_window, const ContextDependencyInterface &ctx_dep, const TransitionModel &trans_model, BaseFloat prob_scale)
Included mainly as a form of documentation, not used in any other code currently. ...
Definition: hmm-utils.cc:153
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:169
bool SplitToPhones ( const TransitionModel &  trans_model,
const std::vector< int32 > &  alignment,
std::vector< std::vector< int32 > > *  split_alignment 
)

SplitToPhones splits up the TransitionIds in "alignment" into their individual phones (one vector per instance of a phone).

At output, the sum of the sizes of the vectors in split_alignment will be the same as the corresponding sum for "alignment". The function returns true on success. If the alignment appears to be incomplete, e.g. not ending at the end-state of a phone, it will still break it up into phones but it will return false. For more serious errors it will die or throw an exception. This function works out by itself whether the graph was created with "reordering", and just does the right thing.

Definition at line 677 of file hmm-utils.cc.

References kaldi::IsReordered(), KALDI_ASSERT, and kaldi::SplitToPhonesInternal().

Referenced by kaldi::AccumulateTreeStats(), kaldi::CompactLatticeToWordProns(), kaldi::ConvertAlignment(), kaldi::IsPlausibleWord(), main(), kaldi::TestConvertAlignment(), and kaldi::TestSplitToPhones().

679  {
680  KALDI_ASSERT(split_alignment != NULL);
681  split_alignment->clear();
682 
683  bool is_reordered = IsReordered(trans_model, alignment);
684  return SplitToPhonesInternal(trans_model, alignment,
685  is_reordered, split_alignment);
686 }
static bool IsReordered(const TransitionModel &trans_model, const std::vector< int32 > &alignment)
Definition: hmm-utils.cc:579
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:169
static bool SplitToPhonesInternal(const TransitionModel &trans_model, const std::vector< int32 > &alignment, bool reordered, std::vector< std::vector< int32 > > *split_output)
Definition: hmm-utils.cc:613
int32 TransitionIdToPdf ( int32  trans_id) const
inline

Definition at line 324 of file transition-model.h.

References TransitionModel::id2pdf_id_, and KALDI_ASSERT.

Referenced by kaldi::AccumulateForUtterance(), DiscriminativeExampleSplitter::CollapseTransitionIds(), DiscriminativeSupervisionSplitter::CollapseTransitionIds(), kaldi::ComputeAmGmmFeatureDeriv(), DiscriminativeExampleSplitter::ComputeFrameInfo(), kaldi::ConvertPosteriorToPdfs(), kaldi::GetPdfToTransitionIdTransducer(), kaldi::LatticeAcousticRescore(), kaldi::nnet1::LatticeAcousticRescore(), NnetDiscriminativeUpdater::LatticeComputations(), kaldi::LatticeForwardBackwardMpeVariants(), DecodableAmDiagGmmRegtreeFmllr::LogLikelihood(), DecodableAmSgmm2::LogLikelihood(), DecodableMatrixScaledMapped::LogLikelihood(), DecodableNnet2Online::LogLikelihood(), DecodableAmNnet::LogLikelihood(), DecodableAmDiagGmmRegtreeMllr::LogLikelihood(), DecodableAmDiagGmm::LogLikelihood(), DecodableAmSgmm2Scaled::LogLikelihood(), DecodableAmNnetParallel::LogLikelihood(), DecodableAmDiagGmmScaled::LogLikelihood(), DecodableMatrixMappedOffset::LogLikelihood(), DecodableAmNnetLoopedOnline::LogLikelihood(), DecodableAmNnetSimple::LogLikelihood(), DecodableAmNnetSimpleLooped::LogLikelihood(), DecodableAmNnetSimpleParallel::LogLikelihood(), DiscriminativeComputation::LookupNnetOutput(), main(), ComparePosteriorByPdfs::operator()(), kaldi::PosteriorToPdfMatrix(), kaldi::RescoreCompactLatticeInternal(), kaldi::nnet3::SetPriors(), and kaldi::nnet2::SetPriors().

324  {
325  KALDI_ASSERT(static_cast<size_t>(trans_id) < id2pdf_id_.size() &&
326  "Likely graph/model mismatch (graph built from wrong model?)");
327  return id2pdf_id_[trans_id];
328 }
std::vector< int32 > id2pdf_id_
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:169

Variable Documentation

const int32 kNoPdf = -1
static

A constant used in the HmmTopology class as the pdf-class kNoPdf, which is used when a HMM-state is nonemitting (has no associated PDF).

Definition at line 87 of file hmm-topology.h.

Referenced by HmmTopology::Check(), TransitionModel::ComputeTuplesIsHmm(), TransitionModel::ComputeTuplesNotHmm(), kaldi::GetHmmAsFst(), kaldi::GetHmmAsFstSimple(), HmmTopology::Read(), kaldi::SplitToPhonesInternal(), and HmmTopology::Write().