Functions | |
void | AddOutputToGraph (const ComputationRequest &request, const Nnet &nnet, ComputationGraph *graph) |
void | AddInputToGraph (const ComputationRequest &request, const Nnet &nnet, ComputationGraph *graph) |
static void | ComputeDependenciesSubset (const ComputationGraph &graph, const std::vector< int32 > &cindex_id_to_segment_and_epoch, std::vector< std::vector< int32 > > *dependencies_subset) |
This function outputs to dependencies_subset[c], for each cindex_id c, the subset of elements d of graph.dependencies[c] such that cindex_id_to_segment_and_epoch[d] == cindex_id_to_segment_and_epoch[c]. More... | |
static void | ComputeEpochInfo (const Nnet &nnet, const ComputationGraph &graph, std::vector< int32 > *cindex_id_to_segment_and_epoch, std::vector< std::vector< std::vector< int32 > > > *epochs_per_segment, std::vector< bool > *epoch_is_trivial) |
This function computes certain information about "epochs" of cindex_ids. More... | |
void kaldi::nnet3::computation_graph::AddInputToGraph | ( | const ComputationRequest & | request, |
const Nnet & | nnet, | ||
ComputationGraph * | graph | ||
) |
Definition at line 994 of file nnet-computation-graph.cc.
References ComputationGraph::GetCindexId(), Nnet::GetNode(), Nnet::GetNodeIndex(), rnnlm::i, ComputationRequest::inputs, rnnlm::j, KALDI_ASSERT, KALDI_ERR, kaldi::nnet3::kComponent, kaldi::nnet3::kInput, rnnlm::n, and NetworkNode::node_type.
Referenced by kaldi::nnet3::ComputeComputationGraph().
void kaldi::nnet3::computation_graph::AddOutputToGraph | ( | const ComputationRequest & | request, |
const Nnet & | nnet, | ||
ComputationGraph * | graph | ||
) |
Definition at line 971 of file nnet-computation-graph.cc.
References ComputationGraph::GetCindexId(), Nnet::GetNodeIndex(), rnnlm::i, rnnlm::j, KALDI_ASSERT, KALDI_ERR, rnnlm::n, and ComputationRequest::outputs.
Referenced by kaldi::nnet3::ComputeComputationGraph().
|
static |
This function outputs to dependencies_subset[c], for each cindex_id c, the subset of elements d of graph.dependencies[c] such that cindex_id_to_segment_and_epoch[d] == cindex_id_to_segment_and_epoch[c].
That is, it's the dependency graph of the entire computation, but removing links that go from one segment/epoch to another segment/epoch. Topologically, 'dependencies_subset' would therefore consist of a bunch of disconnected graphs.
Definition at line 1028 of file nnet-computation-graph.cc.
References ComputationGraph::cindexes, rnnlm::d, ComputationGraph::dependencies, rnnlm::i, and KALDI_ASSERT.
Referenced by kaldi::nnet3::ComputeComputationPhases().
|
static |
This function computes certain information about "epochs" of cindex_ids.
The function ComputeNnetComputationEpochs() from nnet-graph.h gives us a map from the NetworkNode index to an index we call the "epoch" index: basically, nodes that are computed first have a lower epoch index, and all nodes that are part of strongly connected components have the same epoch index. In an acyclic nnet graph each component will usually have its own epoch index, but in things like LSTMs, each LSTM layer (with multiple components) will have its own epoch index.
The overall computation order that we compute, will respect this ordering into epochs (except that outputs of nodes of type kComponent that are actually provided as inputs to the network, won't be subject to these limitations but will come first in the order)... we will just ignore the output of this function as it concerns cindex-ids that are provided as input to the network.
nnet | [in] The neural net |
graph | [in] The computation graph |
cindex_id_to_segment_and_epoch | [out] A vector that maps cindex_id to a number that is the same if two cindex_ids are in the same segment and same epoch, and different otherwise. This number combines the segment index and the epoch index; the details are not important to the calling code. |
epochs_per_segment | [out] This is a listing of all the cindex_ids in the computation graph, divided up first by segment and then by epoch. |
epoch_is_trivial | [out] A vector of bool, indexed by the epoch index which is the same as the second index of 'epochs_per_segment', that's true if this epoch index corresponds to just a single NetworkNode (and also true for epoch indexes corresponding to inputs to the network, which will be the first epoch of each segment). This depends on the neural network structure only. |
Definition at line 1082 of file nnet-computation-graph.cc.
References ComputationGraph::cindexes, kaldi::nnet3::ComputeNnetComputationEpochs(), rnnlm::i, ComputationGraph::is_input, KALDI_ASSERT, KALDI_VLOG, rnnlm::n, Nnet::NumNodes(), kaldi::nnet3::PrintIntegerVector(), and ComputationGraph::segment_ends.
Referenced by kaldi::nnet3::ComputeComputationPhases().