Sgmm2GauPost Class Reference

indexed by time. More...

#include <am-sgmm2.h>

Inheritance diagram for Sgmm2GauPost:
Collaboration diagram for Sgmm2GauPost:

Public Member Functions

 Sgmm2GauPost (size_t i)
 
 Sgmm2GauPost ()
 
void Write (std::ostream &os, bool binary) const
 
void Read (std::istream &is, bool binary)
 

Detailed Description

indexed by time.

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

Constructor & Destructor Documentation

◆ Sgmm2GauPost() [1/2]

Sgmm2GauPost ( size_t  i)
inlineexplicit

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

572 : std::vector<Sgmm2GauPostElement>(i) {}

◆ Sgmm2GauPost() [2/2]

Sgmm2GauPost ( )
inline

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

573 {}

Member Function Documentation

◆ Read()

void Read ( std::istream &  is,
bool  binary 
)

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

References kaldi::ExpectToken(), rnnlm::i, KALDI_ASSERT, kaldi::ReadBasicType(), kaldi::ReadIntegerVector(), and Sgmm2LikelihoodCache::t.

1472  {
1473  ExpectToken(is, binary, "<Sgmm2GauPost>");
1474  int32 T;
1475  ReadBasicType(is, binary, &T);
1476  KALDI_ASSERT(T >= 0);
1477  this->resize(T);
1478  for (int32 t = 0; t < T; t++) {
1479  ExpectToken(is, binary, "<gselect>");
1480  ReadIntegerVector(is, binary, &((*this)[t].gselect));
1481  ExpectToken(is, binary, "<tids>");
1482  ReadIntegerVector(is, binary, &((*this)[t].tids));
1483  size_t sz = (*this)[t].tids.size();
1484  (*this)[t].posteriors.resize(sz);
1485  for (size_t i = 0; i < sz; i++)
1486  (*this)[t].posteriors[i].Read(is, binary);
1487  }
1488  ExpectToken(is, binary, "</Sgmm2GauPost>");
1489 }
void ReadBasicType(std::istream &is, bool binary, T *t)
ReadBasicType is the name of the read function for bool, integer types, and floating-point types...
Definition: io-funcs-inl.h:55
kaldi::int32 int32
void ReadIntegerVector(std::istream &is, bool binary, std::vector< T > *v)
Function for reading STL vector of integer types.
Definition: io-funcs-inl.h:232
void ExpectToken(std::istream &is, bool binary, const char *token)
ExpectToken tries to read in the given token, and throws an exception on failure. ...
Definition: io-funcs.cc:191
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:185

◆ Write()

void Write ( std::ostream &  os,
bool  binary 
) const

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

References rnnlm::i, KALDI_ASSERT, Sgmm2LikelihoodCache::t, kaldi::WriteBasicType(), kaldi::WriteIntegerVector(), and kaldi::WriteToken().

1454  {
1455  WriteToken(os, binary, "<Sgmm2GauPost>");
1456  int32 T = this->size();
1457  WriteBasicType(os, binary, T);
1458  for (int32 t = 0; t < T; t++) {
1459  WriteToken(os, binary, "<gselect>");
1460  WriteIntegerVector(os, binary, (*this)[t].gselect);
1461  WriteToken(os, binary, "<tids>");
1462  WriteIntegerVector(os, binary, (*this)[t].tids);
1463  KALDI_ASSERT((*this)[t].tids.size() == (*this)[t].posteriors.size());
1464  for (size_t i = 0; i < (*this)[t].posteriors.size(); i++) {
1465  (*this)[t].posteriors[i].Write(os, binary);
1466  }
1467  }
1468  WriteToken(os, binary, "</Sgmm2GauPost>");
1469 }
kaldi::int32 int32
void WriteToken(std::ostream &os, bool binary, const char *token)
The WriteToken functions are for writing nonempty sequences of non-space characters.
Definition: io-funcs.cc:134
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:185
void WriteIntegerVector(std::ostream &os, bool binary, const std::vector< T > &v)
Function for writing STL vectors of integer types.
Definition: io-funcs-inl.h:198
void WriteBasicType(std::ostream &os, bool binary, T t)
WriteBasicType is the name of the write function for bool, integer types, and floating-point types...
Definition: io-funcs-inl.h:34

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