This class performs various kinds of specific analysis on top of what class Analyzer gives you immediately. More...
#include <nnet-analyze.h>
Public Member Functions | |
ComputationAnalysis (const NnetComputation &computation, const Analyzer &analyzer) | |
This class stores the const references provided to its constructor -> be careful about changing them or deallocating them during the lifetime of this object. More... | |
int32 | FirstNontrivialAccess (int32 s) const |
Returns the first command (read or write) that accesses any part of 's' except for zeroing it (i.e. More... | |
int32 | FirstAccess (int32 s) const |
Returns the first command (read or write) that accesses any part of 's', including possibly zeroing it. More... | |
int32 | LastAccess (int32 s) const |
Returns the last non-deallocation command that accesses any part of submatrix 's'; if there is no such command it returns -1. More... | |
int32 | LastWriteAccess (int32 s) const |
Returns the last command-index that accesses any part of submatrix 's' as a write operation, or -1 if there is no such operation. More... | |
int32 | DataInvalidatedCommand (int32 c, int32 s) const |
Returns (the first command-index after 'c' that any part of submatrix 's' is written to); or if there is no such command, then (the command-index of the command that deallocates the matrix underlying s); or if there is no such command, then the total number of commands. More... | |
int32 | FirstNontrivialMatrixAccess (int32 m) const |
Returns the first command that is not a zeroing command (kSetConst with alpha=0.0), that accesses any part of 'm' [note: allocation and deallocation do not count a matrix accesses. More... | |
int32 | LastMatrixAccess (int32 m) const |
Returns the last non-deallocation command that accesses any part of matrix 'm'; if there is no such command it returns -1. More... | |
Private Attributes | |
const NnetComputation & | computation_ |
const Analyzer & | analyzer_ |
This class performs various kinds of specific analysis on top of what class Analyzer gives you immediately.
It mostly contains special-purpose things what were needed by class VariableMergingOptimizer (see nnet-optimize.h, and the extended comment above class VariableMergingOptimizer). Be careful about the meaninhg of 'access'- read the comments carefully.
Definition at line 308 of file nnet-analyze.h.
|
inline |
This class stores the const references provided to its constructor -> be careful about changing them or deallocating them during the lifetime of this object.
Definition at line 313 of file nnet-analyze.h.
Returns (the first command-index after 'c' that any part of submatrix 's' is written to); or if there is no such command, then (the command-index of the command that deallocates the matrix underlying s); or if there is no such command, then the total number of commands.
s must be >0 (i.e. not the empty submatrix).
Definition at line 1323 of file nnet-analyze.cc.
References NnetComputation::commands, ComputationChecker::computation_, KALDI_ASSERT, kaldi::nnet3::kReadAccess, and NnetComputation::submatrices.
Referenced by VariableMergingOptimizer::MayBeMerged(), and kaldi::nnet3::UnitTestNnetAnalyze().
Returns the first command (read or write) that accesses any part of 's', including possibly zeroing it.
[note: kAllocMatrix, kSwapMatrix and kDeallocMatrix do not count as read or write operations]. If there is no such command, it returns num_commands. s must be >0 (i.e. not the empty submatrix).
Definition at line 1209 of file nnet-analyze.cc.
References NnetComputation::commands, ComputationChecker::computation_, KALDI_ASSERT, and NnetComputation::submatrices.
Returns the first command (read or write) that accesses any part of 's' except for zeroing it (i.e.
kSetConst with zero alpha). [note: kAllocMatrix, kSwapMatrix and kDeallocMatrix do not count as read or write operations]. If there is no such command, it returns num_commands. s must be >0 (i.e. not the empty submatrix).
Definition at line 1182 of file nnet-analyze.cc.
References NnetComputation::Command::alpha, NnetComputation::Command::command_type, NnetComputation::commands, ComputationChecker::computation_, KALDI_ASSERT, kaldi::nnet3::kSetConst, and NnetComputation::submatrices.
Referenced by kaldi::nnet3::ConvertAdditionToAssignment(), ComputationLoopedOptimizer::FindActiveMatrices(), VariableMergingOptimizer::MayBeMerged(), and kaldi::nnet3::UnitTestNnetAnalyze().
Returns the first command that is not a zeroing command (kSetConst with alpha=0.0), that accesses any part of 'm' [note: allocation and deallocation do not count a matrix accesses.
] If there is no such command, it returns num_commands. m must be >0 (i.e. not the empty matrix).
Definition at line 1226 of file nnet-analyze.cc.
References NnetComputation::Command::alpha, NnetComputation::Command::command_type, NnetComputation::commands, ComputationChecker::computation_, KALDI_ASSERT, kaldi::nnet3::kSetConst, and NnetComputation::matrices.
Referenced by VariableMergingOptimizer::DoMerge().
Returns the last non-deallocation command that accesses any part of submatrix 's'; if there is no such command it returns -1.
s must be >0 (i.e. not the empty submatrix).
Definition at line 1264 of file nnet-analyze.cc.
References NnetComputation::commands, ComputationChecker::computation_, KALDI_ASSERT, kaldi::nnet3::kDeallocMatrix, and NnetComputation::submatrices.
Referenced by ComputationLoopedOptimizer::FindActiveMatrices(), VariableMergingOptimizer::MayBeMerged(), and kaldi::nnet3::UnitTestNnetAnalyze().
Returns the last non-deallocation command that accesses any part of matrix 'm'; if there is no such command it returns -1.
m must be >0 (i.e. not the empty matrix).
Definition at line 1248 of file nnet-analyze.cc.
References ComputationChecker::computation_, KALDI_ASSERT, and NnetComputation::matrices.
Returns the last command-index that accesses any part of submatrix 's' as a write operation, or -1 if there is no such operation.
Note: deallocation does not count as a write operation. s must be >0 (i.e. not the empty submatrix).
Definition at line 1291 of file nnet-analyze.cc.
References NnetComputation::commands, ComputationChecker::computation_, KALDI_ASSERT, kaldi::nnet3::kDeallocMatrix, kaldi::nnet3::kReadAccess, and NnetComputation::submatrices.
Referenced by VariableMergingOptimizer::MayBeMerged(), and kaldi::nnet3::UnitTestNnetAnalyze().
|
private |
Definition at line 364 of file nnet-analyze.h.
|
private |
Definition at line 363 of file nnet-analyze.h.