This class is only used when parsing Descriptors. More...
#include <nnet-descriptor.h>
Public Types | |
enum | DescriptorType { kAppend, kSum, kFailover, kIfDefined, kOffset, kSwitch, kRound, kReplaceIndex, kScale, kConst, kNodeName } |
Public Member Functions | |
GeneralDescriptor (DescriptorType t, int32 value1=-1, int32 value2=-1, BaseFloat alpha=0.0) | |
~GeneralDescriptor () | |
GeneralDescriptor * | GetNormalizedDescriptor () const |
Descriptor * | ConvertToDescriptor () |
void | Print (const std::vector< std::string > &node_names, std::ostream &os) |
Static Public Member Functions | |
static GeneralDescriptor * | Parse (const std::vector< std::string > &node_names, const std::string **next_token) |
Private Member Functions | |
KALDI_DISALLOW_COPY_AND_ASSIGN (GeneralDescriptor) | |
void | ParseAppendOrSumOrSwitch (const std::vector< std::string > &node_names, const std::string **next_token) |
void | ParseIfDefined (const std::vector< std::string > &node_names, const std::string **next_token) |
void | ParseOffset (const std::vector< std::string > &node_names, const std::string **next_token) |
void | ParseSwitch (const std::vector< std::string > &node_names, const std::string **next_token) |
void | ParseFailover (const std::vector< std::string > &node_names, const std::string **next_token) |
void | ParseRound (const std::vector< std::string > &node_names, const std::string **next_token) |
void | ParseScale (const std::vector< std::string > &node_names, const std::string **next_token) |
void | ParseConst (const std::vector< std::string > &node_names, const std::string **next_token) |
void | ParseReplaceIndex (const std::vector< std::string > &node_names, const std::string **next_token) |
int32 | NumAppendTerms () const |
GeneralDescriptor * | GetAppendTerm (int32 term) const |
GeneralDescriptor * | NormalizeAppend () const |
SumDescriptor * | ConvertToSumDescriptor () const |
ForwardingDescriptor * | ConvertToForwardingDescriptor () const |
Static Private Member Functions | |
static bool | Normalize (GeneralDescriptor *ptr) |
Private Attributes | |
DescriptorType | descriptor_type_ |
int32 | value1_ |
int32 | value2_ |
BaseFloat | alpha_ |
std::vector< GeneralDescriptor * > | descriptors_ |
This class is only used when parsing Descriptors.
It is useful for normalizing descriptors that are structured in an invalid or redundant way, into a form that can be turned into a real Descriptor.
Definition at line 609 of file nnet-descriptor.h.
enum DescriptorType |
Enumerator | |
---|---|
kAppend | |
kSum | |
kFailover | |
kIfDefined | |
kOffset | |
kSwitch | |
kRound | |
kReplaceIndex | |
kScale | |
kConst | |
kNodeName |
Definition at line 610 of file nnet-descriptor.h.
|
inlineexplicit |
Definition at line 623 of file nnet-descriptor.h.
|
inline |
Definition at line 629 of file nnet-descriptor.h.
References kaldi::DeletePointers(), ForwardingDescriptor::KALDI_DISALLOW_COPY_AND_ASSIGN(), and fst::Print().
Descriptor * ConvertToDescriptor | ( | ) |
Definition at line 1029 of file nnet-descriptor.cc.
References GeneralDescriptor::ConvertToSumDescriptor(), GeneralDescriptor::descriptor_type_, GeneralDescriptor::descriptors_, and rnnlm::i.
Referenced by kaldi::nnet3::NormalizeTextDescriptor(), Descriptor::Parse(), and kaldi::nnet3::UnitTestGeneralDescriptor().
|
private |
Definition at line 1075 of file nnet-descriptor.cc.
References rnnlm::i, KALDI_ASSERT, KALDI_ERR, ReplaceIndexForwardingDescriptor::kT, and ReplaceIndexForwardingDescriptor::kX.
|
private |
Definition at line 1044 of file nnet-descriptor.cc.
References ConstantSumDescriptor::ConstantSumDescriptor(), KALDI_ASSERT, KALDI_ERR, BinarySumDescriptor::kFailoverOperation, and BinarySumDescriptor::kSumOperation.
Referenced by GeneralDescriptor::ConvertToDescriptor().
|
private |
Definition at line 775 of file nnet-descriptor.cc.
References GeneralDescriptor::descriptors_, rnnlm::i, KALDI_ASSERT, and KALDI_ERR.
GeneralDescriptor * GetNormalizedDescriptor | ( | ) | const |
Definition at line 969 of file nnet-descriptor.cc.
|
private |
|
staticprivate |
Definition at line 823 of file nnet-descriptor.cc.
References GeneralDescriptor::alpha_, GeneralDescriptor::descriptor_type_, GeneralDescriptor::descriptors_, rnnlm::i, KALDI_ASSERT, KALDI_ERR, kaldi::swap(), GeneralDescriptor::value1_, and GeneralDescriptor::value2_.
|
private |
Definition at line 806 of file nnet-descriptor.cc.
References GeneralDescriptor::descriptors_, rnnlm::i, and KALDI_ASSERT.
|
private |
Definition at line 756 of file nnet-descriptor.cc.
References rnnlm::i, and KALDI_ASSERT.
|
static |
Definition at line 585 of file nnet-descriptor.cc.
References kaldi::nnet3::ExpectToken(), rnnlm::i, KALDI_ERR, GeneralDescriptor::ParseAppendOrSumOrSwitch(), GeneralDescriptor::ParseConst(), GeneralDescriptor::ParseFailover(), GeneralDescriptor::ParseIfDefined(), GeneralDescriptor::ParseOffset(), GeneralDescriptor::ParseReplaceIndex(), GeneralDescriptor::ParseRound(), and GeneralDescriptor::ParseScale().
Referenced by kaldi::nnet3::NormalizeTextDescriptor(), Descriptor::Parse(), and kaldi::nnet3::UnitTestGeneralDescriptor().
|
private |
Definition at line 643 of file nnet-descriptor.cc.
References KALDI_ERR.
Referenced by GeneralDescriptor::Parse().
|
private |
Definition at line 690 of file nnet-descriptor.cc.
References kaldi::ConvertStringToInteger(), kaldi::ConvertStringToReal(), kaldi::nnet3::ExpectToken(), and KALDI_ERR.
Referenced by GeneralDescriptor::Parse().
|
private |
Definition at line 668 of file nnet-descriptor.cc.
References kaldi::nnet3::ExpectToken().
Referenced by GeneralDescriptor::Parse().
|
private |
Definition at line 661 of file nnet-descriptor.cc.
References kaldi::nnet3::ExpectToken().
Referenced by GeneralDescriptor::Parse().
|
private |
Definition at line 710 of file nnet-descriptor.cc.
References kaldi::nnet3::ExpectToken(), and kaldi::nnet3::ReadIntegerToken().
Referenced by GeneralDescriptor::Parse().
|
private |
Definition at line 736 of file nnet-descriptor.cc.
References kaldi::nnet3::ExpectToken(), KALDI_ERR, ReplaceIndexForwardingDescriptor::kT, ReplaceIndexForwardingDescriptor::kX, and kaldi::nnet3::ReadIntegerToken().
Referenced by GeneralDescriptor::Parse().
|
private |
Definition at line 726 of file nnet-descriptor.cc.
References kaldi::nnet3::ExpectToken(), and kaldi::nnet3::ReadIntegerToken().
Referenced by GeneralDescriptor::Parse().
|
private |
Definition at line 677 of file nnet-descriptor.cc.
References kaldi::ConvertStringToReal(), kaldi::nnet3::ExpectToken(), and KALDI_ERR.
Referenced by GeneralDescriptor::Parse().
|
private |
void Print | ( | const std::vector< std::string > & | node_names, |
std::ostream & | os | ||
) |
Definition at line 975 of file nnet-descriptor.cc.
References rnnlm::i, KALDI_ASSERT, ReplaceIndexForwardingDescriptor::kT, and ReplaceIndexForwardingDescriptor::kX.
|
private |
Definition at line 661 of file nnet-descriptor.h.
Referenced by GeneralDescriptor::Normalize().
|
private |
Definition at line 642 of file nnet-descriptor.h.
Referenced by GeneralDescriptor::ConvertToDescriptor(), and GeneralDescriptor::Normalize().
|
private |
Definition at line 665 of file nnet-descriptor.h.
Referenced by GeneralDescriptor::ConvertToDescriptor(), GeneralDescriptor::GetAppendTerm(), GeneralDescriptor::Normalize(), and GeneralDescriptor::NormalizeAppend().
|
private |
Definition at line 650 of file nnet-descriptor.h.
Referenced by GeneralDescriptor::Normalize().
|
private |
Definition at line 655 of file nnet-descriptor.h.
Referenced by GeneralDescriptor::Normalize().