This file contains class definitions for classes ForwardingDescriptor, SumDescriptor and Descriptor. More...
#include "base/kaldi-common.h"
#include "util/kaldi-io.h"
#include "matrix/matrix-lib.h"
#include "nnet3/nnet-common.h"
#include "nnet3/nnet-component-itf.h"
#include <iostream>
#include <sstream>
#include <vector>
#include <map>
Go to the source code of this file.
Classes | |
class | ForwardingDescriptor |
A ForwardingDescriptor describes how we copy data from another NetworkNode, or from multiple other NetworkNodes, possibly with a scalar weight. More... | |
class | SimpleForwardingDescriptor |
SimpleForwardingDescriptor is the base-case of ForwardingDescriptor, consisting of a source node in the graph with a given scalar weight (which will in the normal case be 1.0). More... | |
class | OffsetForwardingDescriptor |
Offsets in 't' and 'x' values of other ForwardingDescriptors. More... | |
class | SwitchingForwardingDescriptor |
Chooses from different inputs based on the the time index modulo (the number of ForwardingDescriptors given as inputs). More... | |
class | RoundingForwardingDescriptor |
For use in clockwork RNNs and the like, this forwarding-descriptor rounds the time-index t down to the the closest t' <= t that is an exact multiple of t_modulus_. More... | |
class | ReplaceIndexForwardingDescriptor |
This ForwardingDescriptor modifies the indexes (n, t, x) by replacing one of them (normally t) with a constant value and keeping the rest. More... | |
class | SumDescriptor |
This is an abstract base-class. More... | |
class | OptionalSumDescriptor |
This is the case of class SumDescriptor, in which we contain just one term, and that term is optional (an IfDefined() expression). More... | |
class | SimpleSumDescriptor |
This is the normal base-case of SumDescriptor which just wraps a ForwardingDescriptor. More... | |
class | ConstantSumDescriptor |
This is an alternative base-case of SumDescriptor (an alternative to SimpleSumDescriptor) which represents a constant term, e.g. More... | |
class | BinarySumDescriptor |
BinarySumDescriptor can represent either A + B, or (A if defined, else B). More... | |
class | Descriptor |
struct | GeneralDescriptor |
This class is only used when parsing Descriptors. More... | |
Namespaces | |
kaldi | |
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for mispronunciations detection tasks, the reference: | |
kaldi::nnet3 | |
This file contains class definitions for classes ForwardingDescriptor, SumDescriptor and Descriptor.
Basically this is code that specifies how we glue together the outputs of possibly several other network-nodes, as the input of a particular network node (or as an output of the network). In the neural-network code we refer to the top-level descriptor which is Descriptor. The InputDescriptor is a concatenation of features; each part is a SumDescriptor. The SumDescriptor is a summation over a set of features of all the same dimension, each of which is represented by a ForwardingDescriptor. A ForwardingDescriptor in the simplest case just takes just points you to a particular network node, but in general can do things like adding time offsets, and selecting different rows of its matrix from different inputs. Unlike the other descriptors, a ForwardingDescriptor is in general a bit like a parse tree, in that it can in general contain other ForwardingDescriptors.
The following gives an overview of the expressions that can appear in descriptors. Caution; this is a simplification that overgenerates descriptors: not all combinations are allowed.
<descriptor> ::= <node-name> ;; node name of kInput or kComponent node. <descriptor> ::= Append(<descriptor>, <descriptor> [, <descriptor> ... ] ) <descriptor> ::= Sum(<descriptor>, <descriptor>) <descriptor> ::= Const(<value>, <dimension>) ;; e.g. Const(1.0, 512) <descriptor> ::= Scale(<scale>, <descriptor>) ;; e.g. Scale(-1.0, tdnn2) ;; Failover or IfDefined might be useful for time t=-1 in a RNN, for instance. <descriptor> ::= Failover(<descriptor>, <descriptor>) ;; 1st arg if computable, else 2nd <descriptor> ::= IfDefined(<descriptor>) ;; the arg if defined, else zero. <descriptor> ::= Offset(<descriptor>, <t-offset> [, <x-offset> ] ) ;; offsets are integers ;; Switch(...) is intended to be used in clockwork RNNs or similar schemes. It chooses ;; one argument based on the value of t (in the requested Index) modulo the number of ;; arguments <descriptor> ::= Switch(<descriptor>, <descriptor> [, <descriptor> ...]) ;; For use in clockwork RNNs or similar, Round() rounds the time-index t of the ;; requested Index to the next-lowest multiple of the integer <t-modulus>, ;; and evaluates the input argument for the resulting Index. <descriptor> ::= Round(<descriptor>, <t-modulus>) ;; <t-modulus> is an integer ;; ReplaceIndex replaces some <variable-name> (t or x) in the requested Index ;; with a fixed integer <value>. E.g. might be useful when incorporating ;; iVectors; iVector would always have time-index t=0. <descriptor> ::= ReplaceIndex(<descriptor>, <variable-name>, <value>)
Definition in file nnet-descriptor.h.