Classes | |
struct | PointerCompare |
struct | SubMatrixHasher |
Public Member Functions | |
ComputationRenumberer (NnetComputation *computation) | |
void | Renumber () |
Private Member Functions | |
void | RemoveUnusedIndexesMulti () |
void | ComputeSubmatrixIsUsed () |
void | ComputeMatrixIsUsed () |
void | SetUpMappings () |
void | RenumberSubmatrices () |
void | RenumberMatrices () |
void | RemoveIndexesMultiDuplicates () |
void | RenumberIndexes () |
void | RenumberIndexesRanges () |
void | RenumberMemos () |
Static Private Member Functions | |
static void | CreateRenumbering (int32 old_num_elements, const std::vector< int32 > &to_remove, std::vector< int32 > *renumbering) |
creates a renumbering that removes the elements in "to_remove", e.g. More... | |
static int32 | CreateRenumbering (const std::vector< bool > &used, std::vector< int32 > *renumbering) |
creates a renumbering from old to new index that removes the unused elements, e.g. More... | |
Private Attributes | |
std::vector< bool > | submatrix_is_used_ |
std::vector< bool > | submatrix_is_kept_ |
std::vector< bool > | matrix_is_used_ |
NnetComputation * | computation_ |
int32 | num_matrices_new_ |
int32 | num_submatrices_new_ |
std::vector< int32 > | old_to_new_matrix_ |
std::vector< int32 > | old_to_new_submatrix_ |
Definition at line 148 of file nnet-optimize-utils.cc.
|
inline |
Definition at line 150 of file nnet-optimize-utils.cc.
References ComputationRenumberer::ComputeMatrixIsUsed(), ComputationRenumberer::ComputeSubmatrixIsUsed(), ComputationRenumberer::RemoveIndexesMultiDuplicates(), ComputationRenumberer::RemoveUnusedIndexesMulti(), ComputationRenumberer::Renumber(), ComputationRenumberer::RenumberIndexes(), ComputationRenumberer::RenumberIndexesRanges(), ComputationRenumberer::RenumberMatrices(), ComputationRenumberer::RenumberMemos(), ComputationRenumberer::RenumberSubmatrices(), and ComputationRenumberer::SetUpMappings().
|
private |
Definition at line 385 of file nnet-optimize-utils.cc.
References ComputationRenumberer::computation_, NnetComputation::matrices, ComputationRenumberer::matrix_is_used_, NnetComputation::submatrices, and ComputationRenumberer::submatrix_is_used_.
Referenced by ComputationRenumberer::ComputationRenumberer(), and ComputationRenumberer::Renumber().
|
private |
Definition at line 361 of file nnet-optimize-utils.cc.
References ComputationRenumberer::computation_, kaldi::nnet3::IdentifySubmatrixArgsInComputation(), KALDI_ASSERT, NnetComputation::submatrices, and ComputationRenumberer::submatrix_is_used_.
Referenced by ComputationRenumberer::ComputationRenumberer(), and ComputationRenumberer::Renumber().
|
staticprivate |
creates a renumbering that removes the elements in "to_remove", e.g.
if old_num_elements = 3 and to_remove = [1], would output the vector [ 0, -1, 1 ].
Definition at line 271 of file nnet-optimize-utils.cc.
References rnnlm::i, kaldi::IsSortedAndUniq(), and KALDI_ASSERT.
Referenced by ComputationRenumberer::PointerCompare< T >::operator()(), ComputationRenumberer::RemoveUnusedIndexesMulti(), and ComputationRenumberer::SetUpMappings().
|
staticprivate |
creates a renumbering from old to new index that removes the unused elements, e.g.
if used == [ true, false, true, true], would output the vector [ 0, -1, 1, 2 ]. Returns number of new elements, i.e. the number of elements of 'used' that were true.
Definition at line 256 of file nnet-optimize-utils.cc.
|
private |
Definition at line 538 of file nnet-optimize-utils.cc.
References NnetComputation::commands, ComputationRenumberer::computation_, rnnlm::i, kaldi::nnet3::IdentifyIndexesMultiArgs(), and NnetComputation::indexes_multi.
Referenced by ComputationRenumberer::ComputationRenumberer(), and ComputationRenumberer::Renumber().
|
private |
Definition at line 502 of file nnet-optimize-utils.cc.
References NnetComputation::commands, ComputationRenumberer::computation_, ComputationRenumberer::CreateRenumbering(), rnnlm::i, kaldi::nnet3::IdentifyIndexesMultiArgs(), NnetComputation::indexes_multi, and KALDI_ASSERT.
Referenced by ComputationRenumberer::ComputationRenumberer(), and ComputationRenumberer::Renumber().
void Renumber | ( | ) |
Definition at line 489 of file nnet-optimize-utils.cc.
References ComputationRenumberer::ComputeMatrixIsUsed(), ComputationRenumberer::ComputeSubmatrixIsUsed(), ComputationRenumberer::RemoveIndexesMultiDuplicates(), ComputationRenumberer::RemoveUnusedIndexesMulti(), ComputationRenumberer::RenumberIndexes(), ComputationRenumberer::RenumberIndexesRanges(), ComputationRenumberer::RenumberMatrices(), ComputationRenumberer::RenumberMemos(), ComputationRenumberer::RenumberSubmatrices(), and ComputationRenumberer::SetUpMappings().
Referenced by ComputationRenumberer::ComputationRenumberer(), and kaldi::nnet3::RenumberComputation().
|
private |
Definition at line 581 of file nnet-optimize-utils.cc.
References NnetComputation::commands, ComputationRenumberer::computation_, rnnlm::i, kaldi::nnet3::IdentifyIndexesArgs(), NnetComputation::indexes, and KALDI_ASSERT.
Referenced by ComputationRenumberer::ComputationRenumberer(), and ComputationRenumberer::Renumber().
|
private |
Definition at line 635 of file nnet-optimize-utils.cc.
References NnetComputation::commands, ComputationRenumberer::computation_, rnnlm::i, kaldi::nnet3::IdentifyIndexesRangesArgs(), NnetComputation::indexes_ranges, and KALDI_ASSERT.
Referenced by ComputationRenumberer::ComputationRenumberer(), and ComputationRenumberer::Renumber().
|
private |
Definition at line 454 of file nnet-optimize-utils.cc.
References ComputationRenumberer::computation_, KALDI_ASSERT, NnetComputation::matrices, NnetComputation::matrix_debug_info, ComputationRenumberer::matrix_is_used_, ComputationRenumberer::old_to_new_matrix_, and NnetComputation::submatrices.
Referenced by ComputationRenumberer::ComputationRenumberer(), and ComputationRenumberer::Renumber().
|
private |
Definition at line 296 of file nnet-optimize-utils.cc.
References NnetComputation::Command::arg5, NnetComputation::Command::arg7, NnetComputation::Command::command_type, NnetComputation::commands, ComputationRenumberer::computation_, KALDI_ASSERT, kaldi::nnet3::kBackprop, and kaldi::nnet3::kPropagate.
Referenced by ComputationRenumberer::ComputationRenumberer(), and ComputationRenumberer::Renumber().
|
private |
Definition at line 428 of file nnet-optimize-utils.cc.
References ComputationRenumberer::computation_, kaldi::nnet3::IdentifySubmatrixArgsInComputation(), KALDI_ASSERT, ComputationRenumberer::old_to_new_submatrix_, NnetComputation::submatrices, and ComputationRenumberer::submatrix_is_kept_.
Referenced by ComputationRenumberer::ComputationRenumberer(), and ComputationRenumberer::Renumber().
|
private |
Definition at line 401 of file nnet-optimize-utils.cc.
References ComputationRenumberer::computation_, ComputationRenumberer::CreateRenumbering(), ComputationRenumberer::matrix_is_used_, ComputationRenumberer::num_matrices_new_, ComputationRenumberer::num_submatrices_new_, ComputationRenumberer::old_to_new_matrix_, ComputationRenumberer::old_to_new_submatrix_, NnetComputation::submatrices, ComputationRenumberer::submatrix_is_kept_, and ComputationRenumberer::submatrix_is_used_.
Referenced by ComputationRenumberer::ComputationRenumberer(), and ComputationRenumberer::Renumber().
|
private |
Definition at line 244 of file nnet-optimize-utils.cc.
Referenced by ComputationRenumberer::ComputeMatrixIsUsed(), ComputationRenumberer::ComputeSubmatrixIsUsed(), ComputationRenumberer::RemoveIndexesMultiDuplicates(), ComputationRenumberer::RemoveUnusedIndexesMulti(), ComputationRenumberer::RenumberIndexes(), ComputationRenumberer::RenumberIndexesRanges(), ComputationRenumberer::RenumberMatrices(), ComputationRenumberer::RenumberMemos(), ComputationRenumberer::RenumberSubmatrices(), and ComputationRenumberer::SetUpMappings().
|
private |
Definition at line 243 of file nnet-optimize-utils.cc.
Referenced by ComputationRenumberer::ComputeMatrixIsUsed(), ComputationRenumberer::RenumberMatrices(), and ComputationRenumberer::SetUpMappings().
|
private |
Definition at line 245 of file nnet-optimize-utils.cc.
Referenced by ComputationRenumberer::SetUpMappings().
|
private |
Definition at line 246 of file nnet-optimize-utils.cc.
Referenced by ComputationRenumberer::SetUpMappings().
|
private |
Definition at line 247 of file nnet-optimize-utils.cc.
Referenced by ComputationRenumberer::RenumberMatrices(), and ComputationRenumberer::SetUpMappings().
|
private |
Definition at line 250 of file nnet-optimize-utils.cc.
Referenced by ComputationRenumberer::RenumberSubmatrices(), and ComputationRenumberer::SetUpMappings().
|
private |
Definition at line 239 of file nnet-optimize-utils.cc.
Referenced by ComputationRenumberer::RenumberSubmatrices(), and ComputationRenumberer::SetUpMappings().
|
private |
Definition at line 235 of file nnet-optimize-utils.cc.
Referenced by ComputationRenumberer::ComputeMatrixIsUsed(), ComputationRenumberer::ComputeSubmatrixIsUsed(), and ComputationRenumberer::SetUpMappings().