All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ComponentPrecomputedIndexes Class Referenceabstract

#include <nnet-component-itf.h>

Inheritance diagram for ComponentPrecomputedIndexes:

Public Member Functions

virtual
ComponentPrecomputedIndexes
Copy () const =0
 
virtual void Write (std::ostream &os, bool binary) const =0
 
virtual void Read (std::istream &os, bool binary)=0
 
virtual std::string Type () const =0
 
virtual ~ComponentPrecomputedIndexes ()
 

Static Public Member Functions

static
ComponentPrecomputedIndexes
ReadNew (std::istream &is, bool binary)
 
static
ComponentPrecomputedIndexes
NewComponentPrecomputedIndexesOfType (const std::string &cpi_type)
 

Detailed Description

Definition at line 105 of file nnet-component-itf.h.

Constructor & Destructor Documentation

virtual ~ComponentPrecomputedIndexes ( )
inlinevirtual

Definition at line 115 of file nnet-component-itf.h.

115 { }

Member Function Documentation

ComponentPrecomputedIndexes * NewComponentPrecomputedIndexesOfType ( const std::string &  cpi_type)
static

Definition at line 51 of file nnet-component-itf.cc.

References KALDI_ASSERT, and ComponentPrecomputedIndexes::Type().

Referenced by ComponentPrecomputedIndexes::ReadNew().

52  {
53  ComponentPrecomputedIndexes *ans = NULL;
54  if (cpi_type == "DistributeComponentPrecomputedIndexes") {
55  ans = new DistributeComponentPrecomputedIndexes();
56  } else if (cpi_type == "StatisticsExtractionComponentPrecomputedIndexes") {
57  ans = new StatisticsExtractionComponentPrecomputedIndexes();
58  } else if (cpi_type == "StatisticsPoolingComponentPrecomputedIndexes") {
59  ans = new StatisticsPoolingComponentPrecomputedIndexes();
60  } else if (cpi_type == "BackpropTruncationComponentPrecomputedIndexes") {
61  ans = new BackpropTruncationComponentPrecomputedIndexes();
62  } else if (cpi_type == "TimeHeightConvolutionComponentPrecomputedIndexes") {
63  ans = new TimeHeightConvolutionComponent::PrecomputedIndexes();
64  }
65  if (ans != NULL) {
66  KALDI_ASSERT(cpi_type == ans->Type());
67  }
68  return ans;
69 }
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:169
ComponentPrecomputedIndexes * ReadNew ( std::istream &  is,
bool  binary 
)
static

Definition at line 38 of file nnet-component-itf.cc.

References KALDI_ERR, ComponentPrecomputedIndexes::NewComponentPrecomputedIndexesOfType(), ComponentPrecomputedIndexes::Read(), and kaldi::ReadToken().

Referenced by NnetComputation::Read().

39  {
40  std::string token;
41  ReadToken(is, binary, &token); // e.g. "<DistributePrecomputedComponentIndexes>".
42  token.erase(0, 1); // erase "<".
43  token.erase(token.length()-1); // erase ">".
44  ComponentPrecomputedIndexes *ans = NewComponentPrecomputedIndexesOfType(token);
45  if (!ans)
46  KALDI_ERR << "Unknown ComponentPrecomputedIndexes type " << token;
47  ans->Read(is, binary);
48  return ans;
49 }
void ReadToken(std::istream &is, bool binary, std::string *str)
ReadToken gets the next token and puts it in str (exception on failure).
Definition: io-funcs.cc:154
#define KALDI_ERR
Definition: kaldi-error.h:127
static ComponentPrecomputedIndexes * NewComponentPrecomputedIndexesOfType(const std::string &cpi_type)

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