Chooses from different inputs based on the the time index modulo (the number of ForwardingDescriptors given as inputs). More...
#include <nnet-descriptor.h>
Public Member Functions | |
virtual Cindex | MapToInput (const Index &ind) const |
virtual int32 | Dim (const Nnet &nnet) const |
virtual ForwardingDescriptor * | Copy () const |
virtual void | WriteConfig (std::ostream &os, const std::vector< std::string > &node_names) const |
virtual int32 | Modulus () const |
This function is for use in things like clockwork RNNs, where shifting the time of the inputs and outputs of the network by some multiple integer n would leave things the same, but shifting by non-multiples would change the network structure. More... | |
virtual void | GetNodeDependencies (std::vector< int32 > *node_indexes) const |
This function appends to "node_indexes" all the node indexes. More... | |
virtual BaseFloat | GetScaleForNode (int32 node_index) const |
This function returns the scale on the node-index 'node_index' when it appears in expressions inside this descriptor, or +infinity if it does not appear. More... | |
SwitchingForwardingDescriptor (std::vector< ForwardingDescriptor *> &src) | |
virtual | ~SwitchingForwardingDescriptor () |
Public Member Functions inherited from ForwardingDescriptor | |
virtual | ~ForwardingDescriptor () |
ForwardingDescriptor () | |
Private Attributes | |
std::vector< ForwardingDescriptor * > | src_ |
Chooses from different inputs based on the the time index modulo (the number of ForwardingDescriptors given as inputs).
This is rarely if ever used. Written form is: `Switch(<descriptor>, <descriptor> [, <descriptor> ...])` e.g. `Switch(tdnn2a, tdnn2b, tdnn2c)`
Definition at line 210 of file nnet-descriptor.h.
|
inline |
Definition at line 227 of file nnet-descriptor.h.
|
inlinevirtual |
Definition at line 229 of file nnet-descriptor.h.
References kaldi::DeletePointers().
|
virtual |
Implements ForwardingDescriptor.
Definition at line 161 of file nnet-descriptor.cc.
References kaldi::cu::Copy(), and rnnlm::i.
Implements ForwardingDescriptor.
Definition at line 213 of file nnet-descriptor.h.
References ForwardingDescriptor::Copy(), ForwardingDescriptor::GetNodeDependencies(), ForwardingDescriptor::GetScaleForNode(), ForwardingDescriptor::Modulus(), and ForwardingDescriptor::WriteConfig().
|
virtual |
This function appends to "node_indexes" all the node indexes.
Implements ForwardingDescriptor.
Definition at line 146 of file nnet-descriptor.cc.
References Descriptor::GetNodeDependencies(), and rnnlm::i.
This function returns the scale on the node-index 'node_index' when it appears in expressions inside this descriptor, or +infinity if it does not appear.
E.g. if the descriptor is just `Scale(tdnn2, 2.0)` and the node index for `tdnn2` is 4, then GetScaleForNode(4) would return 2.0. If a particular node_index > 0 appears in different sub-expressions of the descriptor with different scales it is an error (it's not supported) and this function would crash.
Implements ForwardingDescriptor.
Definition at line 473 of file nnet-descriptor.cc.
References rnnlm::i, and KALDI_ERR.
Implements ForwardingDescriptor.
Definition at line 152 of file nnet-descriptor.cc.
References KALDI_ASSERT, and Index::t.
|
virtual |
This function is for use in things like clockwork RNNs, where shifting the time of the inputs and outputs of the network by some multiple integer n would leave things the same, but shifting by non-multiples would change the network structure.
It returns the smallest modulus to which this descriptor is invariant; the lowest common multiple of all descriptors in the network gives you the modulus for the whole network.
Reimplemented from ForwardingDescriptor.
Definition at line 466 of file nnet-descriptor.cc.
References rnnlm::i, kaldi::Lcm(), and ConstantSumDescriptor::Modulus().
|
virtual |
Implements ForwardingDescriptor.
Definition at line 169 of file nnet-descriptor.cc.
References rnnlm::i, and KALDI_ASSERT.
|
private |
Definition at line 232 of file nnet-descriptor.h.