All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ForwardingDescriptor Class Referenceabstract

A ForwardingDescriptor describes how we copy data from another NetworkNode, or from multiple other NetworkNodes, possibly with a scalar weight. More...

#include <nnet-descriptor.h>

Inheritance diagram for ForwardingDescriptor:

Public Member Functions

virtual Cindex MapToInput (const Index &output) const =0
 
virtual int32 Dim (const Nnet &nnet) const =0
 
virtual ForwardingDescriptorCopy () const =0
 
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 WriteConfig (std::ostream &os, const std::vector< std::string > &node_names) const =0
 
virtual void GetNodeDependencies (std::vector< int32 > *node_indexes) const =0
 This function appends to "node_indexes" all the node indexes. More...
 
virtual BaseFloat GetScaleForNode (int32 node_index) const =0
 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...
 
virtual ~ForwardingDescriptor ()
 
 ForwardingDescriptor ()
 

Private Member Functions

 KALDI_DISALLOW_COPY_AND_ASSIGN (ForwardingDescriptor)
 

Detailed Description

A ForwardingDescriptor describes how we copy data from another NetworkNode, or from multiple other NetworkNodes, possibly with a scalar weight.

In the base case this can just be equivalent to giving the name of another NetworkNode, but we also support things like time-offsets, selecting depending on the index from multiple different inputs, and things like that.

Note: nodes of type kOutput (i.e. output nodes of the network) cannot appear as inputs in any descriptor. This is to simplify compilation.

Definition at line 95 of file nnet-descriptor.h.

Constructor & Destructor Documentation

virtual ~ForwardingDescriptor ( )
inlinevirtual

Definition at line 133 of file nnet-descriptor.h.

133 { }

Definition at line 134 of file nnet-descriptor.h.

134 { }

Member Function Documentation

virtual BaseFloat GetScaleForNode ( int32  node_index) const
pure virtual

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.

Implemented in ReplaceIndexForwardingDescriptor, RoundingForwardingDescriptor, SwitchingForwardingDescriptor, OffsetForwardingDescriptor, and SimpleForwardingDescriptor.

Referenced by OffsetForwardingDescriptor::GetScaleForNode(), RoundingForwardingDescriptor::GetScaleForNode(), ReplaceIndexForwardingDescriptor::GetScaleForNode(), and SimpleSumDescriptor::GetScaleForNode().

KALDI_DISALLOW_COPY_AND_ASSIGN ( ForwardingDescriptor  )
private
virtual int32 Modulus ( ) const
inlinevirtual

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 in RoundingForwardingDescriptor, SwitchingForwardingDescriptor, and OffsetForwardingDescriptor.

Definition at line 113 of file nnet-descriptor.h.

Referenced by OffsetForwardingDescriptor::Modulus(), and SimpleSumDescriptor::Modulus().

113 { return 1; }

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