26   if (
Rand() % 2 != 0) {
    32       offset.
t = 
Rand() % 5;
    33       offset.
x = 
Rand() % 2;
    38       std::vector<ForwardingDescriptor*> vec;
    59   if (
Rand() % 3 != 0) {
    60     bool not_required = (
Rand() % 5 == 0);
    79   std::vector<SumDescriptor*> parts;
    80   for (
int32 part = 0; part < num_parts; part++)
    92     std::vector<std::string> node_names(num_nodes);
    93     for (
int32 i = 0; 
i < node_names.size(); 
i++) {
    94       std::ostringstream ostr;
    96       node_names[
i] = ostr.str();
    99     std::ostringstream ostr;
   105     std::vector<std::string> tokens;
   107     tokens.push_back(
"end of input");
   108     std::istringstream istr(ostr.str());
   109     const std::string *next_token = &(tokens[0]);
   110     bool ans = desc4.
Parse(node_names, &next_token);
   113     std::ostringstream ostr2;
   114     desc2.WriteConfig(ostr2, node_names);
   115     std::ostringstream ostr3;
   117     std::ostringstream ostr4;
   124     if (ostr.str() != ostr4.str()) {
   125       KALDI_WARN << 
"x and y differ: checking that it's due to Offset normalization.";
   126       KALDI_ASSERT(ostr.str().find(
"Offset(Offset") != std::string::npos ||
   127                    (ostr.str().find(
"Offset(") != std::string::npos &&
   128                     ostr.str().find(
", 0)") != std::string::npos));
   138     std::vector<std::string> node_names(num_nodes);
   139     for (
int32 i = 0; 
i < node_names.size(); 
i++) {
   140       std::ostringstream ostr;
   141       ostr << 
"a" << (
i+1);
   142       node_names[
i] = ostr.str();
   145     std::ostringstream ostr;
   151     std::vector<std::string> tokens;
   153     tokens.push_back(
"end of input");
   154     std::istringstream istr(ostr.str());
   155     const std::string *next_token = &(tokens[0]);
   161     if (*next_token != 
"end of input")
   162       KALDI_ERR << 
"Parsing Descriptor, expected end of input but got "   163                 << 
"'" <<  *next_token << 
"'";
   166     std::ostringstream ostr2;
   168     KALDI_LOG << 
"Original descriptor was: " << ostr.str();
   169     KALDI_LOG << 
"Parsed descriptor was: " << ostr2.str();
   170     if (ostr2.str() != ostr.str())
   171       KALDI_WARN << 
"Strings differed.  Check manually.";
   181                                     const std::string &desc_str) {
   182   std::vector<std::string> tokens;
   184   tokens.push_back(
"end of input");
   185   const std::string *next_token = &(tokens[0]);
   188   if (*next_token != 
"end of input")
   189     KALDI_ERR << 
"Parsing Descriptor, expected end of input but got "   190               << 
"'" <<  *next_token << 
"'";
   192   std::ostringstream ostr;
   196   KALDI_LOG << 
"Result of normalizing " << desc_str << 
" is: " << ostr.str();
   201   std::vector<std::string> names;
   202   names.push_back(
"a");
   203   names.push_back(
"b");
   204   names.push_back(
"c");
   205   names.push_back(
"d");
   210                "Sum(Scale(4, a), Sum(Scale(2, b), Scale(2, c)))");
   213                "Sum(Const(1, 512), Scale(-1, a))");
   215                == 
"Offset(a, 5, 6)");
   218                "Sum(Offset(a, 2, 1), Offset(b, 2, 1))");
   220                "Append(Sum(a, c), Sum(b, d))");
   222                "Append(a, b, c, d)");
   224                "Sum(a, Sum(b, Sum(c, d)))");
   233   using namespace kaldi;
   242   KALDI_LOG << 
"Nnet descriptor tests succeeded.";
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
This is the case of class SumDescriptor, in which we contain just one term, and that term is optional...
 
void UnitTestGeneralDescriptorSpecial()
 
bool Parse(const std::vector< std::string > &node_names, const std::string **next_token)
 
This class is only used when parsing Descriptors. 
 
SimpleForwardingDescriptor is the base-case of ForwardingDescriptor, consisting of a source node in t...
 
bool DescriptorTokenize(const std::string &input, std::vector< std::string > *tokens)
This function tokenizes input when parsing Descriptor configuration values. 
 
BinarySumDescriptor can represent either A + B, or (A if defined, else B). 
 
ForwardingDescriptor * GenRandForwardingDescriptor(int32 num_nodes)
 
For use in clockwork RNNs and the like, this forwarding-descriptor rounds the time-index t down to th...
 
static GeneralDescriptor * Parse(const std::vector< std::string > &node_names, const std::string **next_token)
 
struct Index is intended to represent the various indexes by which we number the rows of the matrices...
 
This is an abstract base-class. 
 
Chooses from different inputs based on the the time index modulo (the number of ForwardingDescriptors...
 
This is the normal base-case of SumDescriptor which just wraps a ForwardingDescriptor. 
 
A ForwardingDescriptor describes how we copy data from another NetworkNode, or from multiple other Ne...
 
Descriptor * ConvertToDescriptor()
 
int Rand(struct RandomState *state)
 
void GenRandDescriptor(int32 num_nodes, Descriptor *desc)
 
void UnitTestDescriptorIo()
 
std::string NormalizeTextDescriptor(const std::vector< std::string > &node_names, const std::string &desc_str)
 
Offsets in 't' and 'x' values of other ForwardingDescriptors. 
 
void WriteConfig(std::ostream &os, const std::vector< std::string > &node_names) const
 
SumDescriptor * GenRandSumDescriptor(int32 num_nodes)
 
#define KALDI_ASSERT(cond)
 
This ForwardingDescriptor modifies the indexes (n, t, x) by replacing one of them (normally t) with a...
 
void UnitTestGeneralDescriptor()
 
This file contains class definitions for classes ForwardingDescriptor, SumDescriptor and Descriptor...