#include <nnet-descriptor.h>
Public Member Functions | |
int32 | Dim (const Nnet &nnet) const |
bool | Parse (const std::vector< std::string > &node_names, const std::string **next_token) |
void | WriteConfig (std::ostream &os, const std::vector< std::string > &node_names) const |
void | GetDependencies (const Index &index, std::vector< Cindex > *used_inputs) const |
This function exists to enable us to manage optional dependencies, i.e. More... | |
bool | IsComputable (const Index &ind, const CindexSet &cindex_set, std::vector< Cindex > *used_inputs) const |
Has the same purpose and interface as the IsComputable function of the SumDescriptor function. More... | |
void | GetNodeDependencies (std::vector< int32 > *node_indexes) const |
int32 | Modulus () const |
int32 | NumParts () const |
Returns the number of parts that are concatenated over. More... | |
const SumDescriptor & | Part (int32 n) const |
returns the n'th part. More... | |
Descriptor () | |
Descriptor (const Descriptor &other) | |
Copy constructor. More... | |
Descriptor & | operator= (const Descriptor &other) |
Assignment operator. More... | |
Descriptor (const std::vector< SumDescriptor *> &parts) | |
Takes ownership of pointers in "parts". More... | |
~Descriptor () | |
Destructor. More... | |
Private Member Functions | |
void | Destroy () |
Private Attributes | |
std::vector< SumDescriptor * > | parts_ |
Definition at line 525 of file nnet-descriptor.h.
|
inline |
Definition at line 587 of file nnet-descriptor.h.
|
inline |
|
inline |
Takes ownership of pointers in "parts".
Definition at line 593 of file nnet-descriptor.h.
|
inline |
|
private |
Definition at line 525 of file nnet-descriptor.cc.
References rnnlm::i.
Definition at line 531 of file nnet-descriptor.cc.
References ConstantSumDescriptor::Dim(), and KALDI_ASSERT.
Referenced by Compiler::CreateStepInfo(), and NetworkNode::Dim().
This function exists to enable us to manage optional dependencies, i.e.
for making sense of expressions like (A + (B is present)) and (A if present; if not, B). Suppose we are trying to compute the index "ind", and the user represents that "cindex_set" is the set of Cindexes are available to the computation; then this function will return true if we can compute the expression given these inputs; and if so, will output to "used_inputs" the list of Cindexes (not necessarily unique) that this expression will include. Otherwise it will return false and set used_inputs to the empty vector.
[in] | ind | The index that we want to compute at the output of the Descriptor. |
[in] | cindex_set | The set of Cindexes that are available at the input of the Descriptor. |
[out] | used_inputs | If non-NULL, if this function returns true then to this vector will be *appended* the inputs that will actually participate in the computation. Else (if non-NULL) it will be left unchanged. |
Definition at line 68 of file nnet-descriptor.cc.
References Descriptor::parts_.
Referenced by ComputationGraphBuilder::AddDependencies(), and kaldi::nnet3::ComputeComputationGraph().
void GetNodeDependencies | ( | std::vector< int32 > * | node_indexes | ) | const |
Definition at line 577 of file nnet-descriptor.cc.
References ConstantSumDescriptor::GetNodeDependencies(), and rnnlm::i.
Referenced by Nnet::Check(), SwitchingForwardingDescriptor::GetNodeDependencies(), and kaldi::nnet3::NnetToDirectedGraph().
bool IsComputable | ( | const Index & | ind, |
const CindexSet & | cindex_set, | ||
std::vector< Cindex > * | used_inputs | ||
) | const |
Has the same purpose and interface as the IsComputable function of the SumDescriptor function.
Outputs to used_inputs rather than appending to it, though. used_inputs will not be sorted or have repeats removed.
Definition at line 556 of file nnet-descriptor.cc.
References rnnlm::i, and ConstantSumDescriptor::IsComputable().
Referenced by ComputationGraphBuilder::ComputeComputableInfo(), and ComputationGraphBuilder::PruneDependencies().
int32 Modulus | ( | ) | const |
Definition at line 548 of file nnet-descriptor.cc.
References rnnlm::i, kaldi::Lcm(), and ConstantSumDescriptor::Modulus().
Referenced by Nnet::Modulus().
|
inline |
Returns the number of parts that are concatenated over.
Definition at line 583 of file nnet-descriptor.h.
References rnnlm::n.
Referenced by Compiler::CreateStepInfo(), and ModelCollapser::DescriptorIsCollapsible().
Descriptor & operator= | ( | const Descriptor & | other | ) |
Assignment operator.
Definition at line 541 of file nnet-descriptor.cc.
References rnnlm::i, and Descriptor::parts_.
bool Parse | ( | const std::vector< std::string > & | node_names, |
const std::string ** | next_token | ||
) |
Definition at line 491 of file nnet-descriptor.cc.
References GeneralDescriptor::ConvertToDescriptor(), KALDI_ERR, and GeneralDescriptor::Parse().
Referenced by Nnet::ProcessComponentNodeConfigLine(), Nnet::ProcessOutputNodeConfigLine(), ModelCollapser::ReplaceNodeInDescriptor(), and kaldi::nnet3::UnitTestDescriptorIo().
const SumDescriptor & Part | ( | int32 | n | ) | const |
returns the n'th part.
Definition at line 572 of file nnet-descriptor.cc.
References KALDI_ASSERT, and rnnlm::n.
Referenced by Compiler::CompileBackwardSumDescriptor(), Compiler::CompileForwardSumDescriptor(), Compiler::ComputeInputLocationsList(), Compiler::CreateStepInfo(), and ModelCollapser::DescriptorIsCollapsible().
void WriteConfig | ( | std::ostream & | os, |
const std::vector< std::string > & | node_names | ||
) | const |
Definition at line 510 of file nnet-descriptor.cc.
References rnnlm::i, KALDI_ASSERT, and ConstantSumDescriptor::WriteConfig().
Referenced by SvdApplier::ModifyTopology(), kaldi::nnet3::NormalizeTextDescriptor(), ModelCollapser::ReplaceNodeInDescriptor(), kaldi::nnet3::UnitTestDescriptorIo(), and kaldi::nnet3::UnitTestGeneralDescriptor().
|
private |
Definition at line 600 of file nnet-descriptor.h.
Referenced by Descriptor::GetDependencies(), and Descriptor::operator=().