Sgmm2LikelihoodCache Struct Reference

Sgmm2LikelihoodCache caches SGMM likelihoods at two levels: the final pdf likelihoods, and the sub-state level likelihoods, which means that with the SCTM system we can avoid redundant computation. More...

#include <am-sgmm2.h>

Collaboration diagram for Sgmm2LikelihoodCache:

Classes

struct  PdfCacheElement
 
struct  SubstateCacheElement
 

Public Member Functions

 Sgmm2LikelihoodCache (int32 num_groups, int32 num_pdfs)
 
void NextFrame ()
 

Public Attributes

std::vector< SubstateCacheElementsubstate_cache
 
std::vector< PdfCacheElementpdf_cache
 
int32 t
 

Detailed Description

Sgmm2LikelihoodCache caches SGMM likelihoods at two levels: the final pdf likelihoods, and the sub-state level likelihoods, which means that with the SCTM system we can avoid redundant computation.

You need to call NextFrame() on the cache, between frames.

Definition at line 199 of file am-sgmm2.h.

Constructor & Destructor Documentation

◆ Sgmm2LikelihoodCache()

Sgmm2LikelihoodCache ( int32  num_groups,
int32  num_pdfs 
)
inline

Definition at line 202 of file am-sgmm2.h.

202  :
203  substate_cache(num_groups), pdf_cache(num_pdfs), t(1) { }
std::vector< PdfCacheElement > pdf_cache
Definition: am-sgmm2.h:223
std::vector< SubstateCacheElement > substate_cache
Definition: am-sgmm2.h:222

Member Function Documentation

◆ NextFrame()

void NextFrame ( )

Definition at line 39 of file am-sgmm2.cc.

References rnnlm::i, Sgmm2LikelihoodCache::pdf_cache, Sgmm2LikelihoodCache::substate_cache, and Sgmm2LikelihoodCache::t.

Referenced by DecodableAmSgmm2::LogLikelihoodForPdf().

39  {
40  t++;
41  if (t == 0) {
42  t++; // skip over zero; zero is used to invalidate frames.
43  for (size_t i = 0; i < substate_cache.size(); i++)
44  substate_cache[i].t = 0;
45  for (size_t i = 0; i < pdf_cache.size(); i++)
46  pdf_cache[i].t = 0;
47  }
48 }
std::vector< PdfCacheElement > pdf_cache
Definition: am-sgmm2.h:223
std::vector< SubstateCacheElement > substate_cache
Definition: am-sgmm2.h:222

Member Data Documentation

◆ pdf_cache

std::vector<PdfCacheElement> pdf_cache

Definition at line 223 of file am-sgmm2.h.

Referenced by AmSgmm2::LogLikelihood(), and Sgmm2LikelihoodCache::NextFrame().

◆ substate_cache

std::vector<SubstateCacheElement> substate_cache

Definition at line 222 of file am-sgmm2.h.

Referenced by AmSgmm2::LogLikelihood(), and Sgmm2LikelihoodCache::NextFrame().

◆ t


The documentation for this struct was generated from the following files: