20 #ifndef KALDI_NNET3_NNET_COMPUTATION_GRAPH_H_    21 #define KALDI_NNET3_NNET_COMPUTATION_GRAPH_H_    97                 const std::vector<bool> &keep);
   106   void Print(std::ostream &os, 
const std::vector<std::string> &node_names);
   135   bool AllOutputsAreComputable() 
const;
   139   void ExplainWhyAllOutputsNotComputable() 
const;
   147   void GetComputableInfo(std::vector<std::vector<bool> > *computable) 
const;
   189                   dependencies_computed(false) { }
   196   void PrintCindexId(std::ostream &os, 
int32 cindex_id) 
const;
   200   void ExplainWhyNotComputable(
int32 cindex_id) 
const;
   214   void BuildGraphOneIter();
   219   void UpdateComputableInfo(
int32 cindex_id);
   224   void SetAsWillNotCompute(
int32 cindex_id);
   232   inline void AddCindexId(
int32 cindex_id);
   235   void AddDependencies(
int32 cindex_id);
   238   void IncrementUsableCount(
int32 cindex_id);
   241   void DecrementUsableCount(
int32 cindex_id);
   248   void PruneDependencies(
int32 cindex_id);
   260   void ComputeRequiredArray(
int32 start_cindex_id,
   261                             std::vector<bool> *required) 
const;
   267   void Check(
int32 start_cindex_id) 
const;
   300   bool operator () (
const Cindex &cindex) 
const;
   312             const std::vector<ComputationGraphBuilder::CindexInfo> &info,
   313             bool treat_unknown_as_computable);
   316   const std::vector<ComputationGraphBuilder::CindexInfo> *
info_;
   325   bool operator () (
const Index &index) 
const;
   333            const std::vector<ComputationGraphBuilder::CindexInfo> &info,
   335            bool treat_unknown_as_computable);
   338   const std::vector<ComputationGraphBuilder::CindexInfo> &
info_;
   379     std::vector<std::vector<std::vector<int32> > > *phases_per_segment);
   449                            std::vector<std::vector<int32> > *steps,
   450                            std::vector<std::pair<int32, int32> > *locations);
   455                          const std::vector<std::vector<int32> > &phases);
   472                        const std::vector<Cindex> &sub_phase);
   475   void ProcessDimRangeSubPhase(
const std::vector<Cindex> &sub_phase);
   480                                 const std::vector<Cindex> &sub_phase);
   483   void ProcessComponentStep(
const std::vector<Cindex> &step);
   492   void SplitIntoSubPhases(
const std::vector<int32> &phase,
   493                           std::vector<std::vector<Cindex> > *sub_phase) 
const;
   503                 bool add_if_absent = 
false);
   507   int32 AddStep(std::vector<int32> *cindex_ids);
   512   void ConvertToCindexes(
const std::vector<int32> &cindex_ids,
   513                          std::vector<Cindex> *cindexes) 
const;
   518                                std::vector<Index> *indexes);
   522   static void ConvertToCindexes(
const std::vector<Index> &indexes,
   524                                 std::vector<Cindex> *cindexes);
   529   void ConvertToCindexIds(
const std::vector<Cindex> &cindexes,
   530                           std::vector<int32> *cindex_ids) 
const;
   537   void ConvertToLocations(
   538       const std::vector<int32> &cindex_ids,
   539       std::vector<std::pair<int32, int32> > *locations) 
const;
   545   std::vector<std::vector<int32> > *
steps_;
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
ComputationGraph * graph_
 
ComputationGraph * graph_
 
bool ConvertToIndexes(const std::vector< std::pair< int32, int32 > > &location_vector, int32 *first_value, std::vector< int32 > *second_values)
If it is the case for some i >= 0 that all the .first elements of "location_vector" are either i or -...
 
bool treat_unknown_as_computable_
 
An abstract representation of a set of Indexes. 
 
std::vector< std::pair< int32, int32 > > * locations_
locations_ is a map from cindex_id to the pair of indexes into steps_ where that cindex_id resides...
 
const std::vector< ComputationGraphBuilder::CindexInfo > * info_
 
std::ostream & operator<<(std::ostream &ostream, const Index &index)
 
bool treat_unknown_as_computable_
 
struct Index is intended to represent the various indexes by which we number the rows of the matrices...
 
The two main classes defined in this header are struct ComputationRequest, which basically defines a ...
 
const ComputationGraph & graph_
 
std::pair< int32, Index > Cindex
 
std::vector< Cindex > cindexes
The mapping of cindex_id to Cindex. 
 
std::vector< std::vector< int32 > > dependencies
dependencies[cindex_id] gives you the list of other cindex_ids that this particular cindex_id directl...
 
bool dependencies_computed
 
int32 GetCindexId(const Cindex &cindex, bool is_input, bool *is_new)
Maps a Cindex to an integer cindex_id. 
 
unordered_map< Cindex, int32, CindexHasher > cindex_to_cindex_id_
Maps each Cindex to an integer cindex_id: reverse mapping of "cindexes". 
 
void ComputeComputationPhases(const Nnet &nnet, const ComputationGraph &graph, std::vector< std::vector< std::vector< int32 > > > *phases_per_segment)
This function divides a computation into 'phases', where a 'phase' is a collection of cindexes which ...
 
std::vector< CindexInfo > cindex_info_
 
std::vector< bool > is_input
For each Cindex this tells us whether it was provided as an input to the network. ...
 
std::vector< std::vector< int32 > > depend_on_this_
 
std::vector< int32 > segment_ends
This variable is only of particular interest in a 'multi-segment' computation, which is used while cr...
 
std::vector< std::vector< int32 > > * steps_
steps_ is a pointer to an output that's passed in in the constructor. 
 
void Renumber(int32 start_cindex_id, const std::vector< bool > &keep)
This function renumbers the cindex-ids (but only those with index c >= start_cindex_id,. 
 
std::vector< int32 > current_queue_
 
ComputableInfo computable
 
std::unordered_set< std::pair< int32, int32 >, PairHasher< int32 > > dim_range_nodes_
dim_range_nodes_ is used when allocating steps for nodes of type kDimRangeNode. 
 
const std::vector< ComputationGraphBuilder::CindexInfo > & info_
 
const ComputationGraph & graph_
 
This class arranges the cindex_ids of the computation into a sequence of lists called "steps"...
 
void Print(std::ostream &os, const std::vector< std::string > &node_names)
This function, useful for debugging/visualization purposes, prints out a summary of the computation g...
 
const ComputationRequest * request_
 
The first step in compilation is to turn the ComputationSpecification into a ComputationGraph, where for each Cindex we have a list of other Cindexes that it depends on. 
 
An abstract representation of a set of Cindexes. 
 
A hashing function-object for pairs of ints. 
 
std::vector< int32 > next_queue_