StatisticsPoolingComponentPrecomputedIndexes Class Reference

#include <nnet-general-component.h>

Inheritance diagram for StatisticsPoolingComponentPrecomputedIndexes:
Collaboration diagram for StatisticsPoolingComponentPrecomputedIndexes:

Public Member Functions

virtual ~StatisticsPoolingComponentPrecomputedIndexes ()
 
ComponentPrecomputedIndexesCopy () const
 
virtual void Write (std::ostream &os, bool binary) const
 
virtual void Read (std::istream &is, bool binary)
 
virtual std::string Type () const
 
- Public Member Functions inherited from ComponentPrecomputedIndexes
virtual ~ComponentPrecomputedIndexes ()
 

Public Attributes

CuArray< Int32Pairforward_indexes
 
CuArray< Int32Pairbackward_indexes
 

Additional Inherited Members

- Static Public Member Functions inherited from ComponentPrecomputedIndexes
static ComponentPrecomputedIndexesReadNew (std::istream &is, bool binary)
 
static ComponentPrecomputedIndexesNewComponentPrecomputedIndexesOfType (const std::string &cpi_type)
 

Detailed Description

Definition at line 429 of file nnet-general-component.h.

Constructor & Destructor Documentation

◆ ~StatisticsPoolingComponentPrecomputedIndexes()

Definition at line 448 of file nnet-general-component.h.

448 { }

Member Function Documentation

◆ Copy()

ComponentPrecomputedIndexes* Copy ( ) const
inlinevirtual

Implements ComponentPrecomputedIndexes.

Definition at line 450 of file nnet-general-component.h.

References DistributeComponent::Read(), and DistributeComponent::Write().

450  {
451  return new StatisticsPoolingComponentPrecomputedIndexes(*this);
452  }

◆ Read()

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

Implements ComponentPrecomputedIndexes.

Definition at line 542 of file nnet-general-component.cc.

References kaldi::nnet3::CopyPairVector(), kaldi::ExpectOneOrTwoTokens(), kaldi::nnet3::ExpectToken(), and kaldi::ReadIntegerPairVector().

542  {
543  ExpectOneOrTwoTokens(is, binary,
544  "<StatisticsPoolingComponentPrecomputedIndexes>",
545  "<ForwardIndexes>");
546  std::vector<std::pair<int32, int32> > indexes_cpu;
547  ReadIntegerPairVector(is, binary, &indexes_cpu);
548  CopyPairVector(indexes_cpu, &forward_indexes);
549  ExpectToken(is, binary, "<BackwardIndexes>");
550  ReadIntegerPairVector(is, binary, &indexes_cpu);
551  CopyPairVector(indexes_cpu, &backward_indexes);
552  ExpectToken(is, binary, "</StatisticsPoolingComponentPrecomputedIndexes>");
553 }
static void CopyPairVector(const CuArray< Int32Pair > &in, std::vector< std::pair< int32, int32 > > *out)
void ReadIntegerPairVector(std::istream &is, bool binary, std::vector< std::pair< T, T > > *v)
Function for reading STL vector of pairs of integer types.
Definition: io-funcs-inl.h:131
void ExpectOneOrTwoTokens(std::istream &is, bool binary, const std::string &token1, const std::string &token2)
This function is like ExpectToken but for two tokens, and it will either accept token1 and then token...
Definition: text-utils.cc:536
static void ExpectToken(const std::string &token, const std::string &what_we_are_parsing, const std::string **next_token)

◆ Type()

virtual std::string Type ( ) const
inlinevirtual

Implements ComponentPrecomputedIndexes.

Definition at line 458 of file nnet-general-component.h.

458 { return "StatisticsPoolingComponentPrecomputedIndexes"; }

◆ Write()

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

Implements ComponentPrecomputedIndexes.

Definition at line 530 of file nnet-general-component.cc.

References kaldi::nnet3::CopyPairVector(), kaldi::WriteIntegerPairVector(), and kaldi::WriteToken().

530  {
531  WriteToken(os, binary, "<StatisticsPoolingComponentPrecomputedIndexes>");
532  WriteToken(os, binary, "<ForwardIndexes>");
533  std::vector<std::pair<int32, int32> > indexes_cpu;
534  CopyPairVector(forward_indexes, &indexes_cpu);
535  WriteIntegerPairVector(os, binary, indexes_cpu);
536  WriteToken(os, binary, "<BackwardIndexes>");
537  CopyPairVector(backward_indexes, &indexes_cpu);
538  WriteIntegerPairVector(os, binary, indexes_cpu);
539  WriteToken(os, binary, "</StatisticsPoolingComponentPrecomputedIndexes>");
540 }
void WriteIntegerPairVector(std::ostream &os, bool binary, const std::vector< std::pair< T, T > > &v)
Function for writing STL vectors of pairs of integer types.
Definition: io-funcs-inl.h:93
static void CopyPairVector(const CuArray< Int32Pair > &in, std::vector< std::pair< int32, int32 > > *out)
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

Member Data Documentation

◆ backward_indexes

◆ forward_indexes


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