BinarySumDescriptor can represent either A + B, or (A if defined, else B). More...
#include <nnet-descriptor.h>
Public Types | |
enum | Operation { kSumOperation, kFailoverOperation } |
Public Member Functions | |
virtual void | GetDependencies (const Index &ind, std::vector< Cindex > *dependencies) const |
Given an Index at the output of this Descriptor, append to "dependencies" a list of Cindexes that describes what inputs we potentially depend on. More... | |
virtual bool | IsComputable (const Index &ind, const CindexSet &cindex_set, std::vector< Cindex > *used_inputs) const |
This function exists to enable us to manage optional dependencies, i.e. More... | |
virtual int32 | Dim (const Nnet &nnet) const |
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. More... | |
virtual void | GetNodeDependencies (std::vector< int32 > *node_indexes) const |
This function appends to "node_indexes" a list (not necessarily sorted or unique) of all the node indexes that this descriptor may forward data from. More... | |
virtual int32 | Modulus () const |
virtual void | WriteConfig (std::ostream &os, const std::vector< std::string > &node_names) const |
Written form is: if op_ == kSum then "Sum(<src1>, <src2>)"; if op_ == kFailover, then "Failover(<src1>, <src2>)" If you need more than binary operations, just use Sum(a, Sum(b, c)). More... | |
virtual SumDescriptor * | Copy () const |
BinarySumDescriptor (Operation op, SumDescriptor *src1, SumDescriptor *src2) | |
virtual | ~BinarySumDescriptor () |
Public Member Functions inherited from SumDescriptor | |
virtual | ~SumDescriptor () |
Private Attributes | |
Operation | op_ |
SumDescriptor * | src1_ |
SumDescriptor * | src2_ |
BinarySumDescriptor can represent either A + B, or (A if defined, else B).
Other expressions such as A + (B if defined, else zero), (A if defined, else zero) + (B if defined, else zero), and (A if defined, else B if defined, else zero) can be expressed using combinations of the two provided options for BinarySumDescriptor and the variant
Definition at line 487 of file nnet-descriptor.h.
enum Operation |
|
inline |
Definition at line 511 of file nnet-descriptor.h.
|
inlinevirtual |
Definition at line 513 of file nnet-descriptor.h.
|
virtual |
Implements SumDescriptor.
Definition at line 450 of file nnet-descriptor.cc.
Implements SumDescriptor.
Definition at line 401 of file nnet-descriptor.cc.
References KALDI_ERR.
Given an Index at the output of this Descriptor, append to "dependencies" a list of Cindexes that describes what inputs we potentially depend on.
The output list is not necessarily sorted, and this function doesn't make sure that it's unique.
Implements SumDescriptor.
Definition at line 355 of file nnet-descriptor.cc.
|
virtual |
This function appends to "node_indexes" a list (not necessarily sorted or unique) of all the node indexes that this descriptor may forward data from.
Implements SumDescriptor.
Definition at line 440 of file nnet-descriptor.cc.
This function returns the scale on the node-index 'node_index' when it appears in expressions inside this descriptor.
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. It will return +infinity if the node is >= 0 and does not appear in this descriptor. If node_index < 0, it returns the constant offset value from this descriptor, which will equal 0.0 if there is no expression like `Const(1.0, 512)` in this node. 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 SumDescriptor.
Definition at line 411 of file nnet-descriptor.cc.
References KALDI_ASSERT, and KALDI_ERR.
|
virtual |
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 that this expression will be a summation over.
[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. |
Implements SumDescriptor.
Definition at line 361 of file nnet-descriptor.cc.
References KALDI_ASSERT.
|
virtual |
Implements SumDescriptor.
Definition at line 446 of file nnet-descriptor.cc.
References kaldi::Lcm().
|
virtual |
Written form is: if op_ == kSum then "Sum(<src1>, <src2>)"; if op_ == kFailover, then "Failover(<src1>, <src2>)" If you need more than binary operations, just use Sum(a, Sum(b, c)).
Implements SumDescriptor.
Definition at line 454 of file nnet-descriptor.cc.
References KALDI_ASSERT.
|
private |
Definition at line 515 of file nnet-descriptor.h.
|
private |
Definition at line 516 of file nnet-descriptor.h.
|
private |
Definition at line 517 of file nnet-descriptor.h.