#include <nnet-analyze.h>
Public Member Functions | |
ComputationChecker (const CheckComputationOptions &config, const Nnet &nnet, const NnetComputation &computation) | |
void | Check () |
Private Member Functions | |
void | CheckComputationIndexes () const |
This very basic check just makes sure that all indexes in the commands are within range, that dimensions agree with the request, that row/column dimensions agree with component dimensions. More... | |
void | CheckComputationUndefined () const |
Checks for the situation where a variable is read before being written. More... | |
void | CheckComputationRewrite () const |
Checks for the situation where a read-only operation on a variable is followed by an operation that writes to the variable. More... | |
void | CheckComputationMatrixAccesses () const |
void | CheckComputationCompression () const |
void | CheckComputationDebugInfo () const |
Private Attributes | |
const CheckComputationOptions & | config_ |
const Nnet & | nnet_ |
const NnetComputation & | computation_ |
Analyzer | a_ |
Definition at line 411 of file nnet-analyze.h.
ComputationChecker | ( | const CheckComputationOptions & | config, |
const Nnet & | nnet, | ||
const NnetComputation & | computation | ||
) |
Definition at line 571 of file nnet-analyze.cc.
void Check | ( | ) |
Definition at line 579 of file nnet-analyze.cc.
References ComputationChecker::a_, CheckComputationOptions::check_rewrite, ComputationChecker::CheckComputationCompression(), ComputationChecker::CheckComputationDebugInfo(), ComputationChecker::CheckComputationIndexes(), ComputationChecker::CheckComputationMatrixAccesses(), ComputationChecker::CheckComputationRewrite(), ComputationChecker::CheckComputationUndefined(), ComputationChecker::computation_, ComputationChecker::config_, Analyzer::Init(), and ComputationChecker::nnet_.
Referenced by ComputationCache::Check(), kaldi::nnet3::CheckComputation(), kaldi::nnet3::CheckComputationOnline(), CachingOptimizingCompiler::CompileNoShortcut(), kaldi::nnet3::UnitTestNnetAnalyze(), kaldi::nnet3::UnitTestNnetCompute(), kaldi::nnet3::UnitTestNnetInputDerivatives(), and kaldi::nnet3::UnitTestNnetOptimizeWithOptions().
|
private |
Definition at line 728 of file nnet-analyze.cc.
References ComputationChecker::a_, MatrixAccesses::accesses, NnetComputation::Command::alpha, NnetComputation::Command::arg1, NnetComputation::Command::arg2, Access::command_index, NnetComputation::Command::command_type, NnetComputation::commands, ComputationChecker::computation_, Nnet::GetComponent(), rnnlm::i, KALDI_ASSERT, kaldi::nnet3::kBackprop, kaldi::kCompressedMatrixUint8, kaldi::nnet3::kCompressMatrix, kaldi::nnet3::kDecompressMatrix, kaldi::nnet3::kNoOperationMarker, Analyzer::matrix_accesses, ComputationChecker::nnet_, and Component::Type().
Referenced by ComputationChecker::Check().
|
private |
Definition at line 1094 of file nnet-analyze.cc.
References ComputationChecker::computation_, rnnlm::i, KALDI_ERR, NnetComputation::matrices, and NnetComputation::matrix_debug_info.
Referenced by ComputationChecker::Check().
|
private |
This very basic check just makes sure that all indexes in the commands are within range, that dimensions agree with the request, that row/column dimensions agree with component dimensions.
Definition at line 791 of file nnet-analyze.cc.
References NnetComputation::Command::alpha, NnetComputation::Command::arg1, NnetComputation::Command::arg2, NnetComputation::Command::arg3, NnetComputation::Command::arg4, NnetComputation::Command::arg5, NnetComputation::Command::arg6, NnetComputation::Command::arg7, NnetComputation::Command::command_type, NnetComputation::commands, NnetComputation::component_precomputed_indexes, ComputationChecker::computation_, Nnet::GetComponent(), NnetComputation::indexes, NnetComputation::indexes_multi, NnetComputation::indexes_ranges, Component::InputDim(), Nnet::IsInputNode(), Nnet::IsOutputNode(), NnetComputation::IsWholeMatrix(), kaldi::nnet3::kAcceptInput, kaldi::nnet3::kAddRowRanges, kaldi::nnet3::kAddRows, kaldi::nnet3::kAddRowsMulti, kaldi::nnet3::kAddToRowsMulti, KALDI_ASSERT, KALDI_ERR, kaldi::nnet3::kAllocMatrix, kaldi::nnet3::kBackprop, kaldi::nnet3::kBackpropInPlace, kaldi::nnet3::kBackpropNeedsInput, kaldi::nnet3::kBackpropNeedsOutput, kaldi::nnet3::kBackpropNoModelUpdate, kaldi::kCompressedMatrixInt8, kaldi::kCompressedMatrixUint16, kaldi::kCompressedMatrixUint8, kaldi::nnet3::kCompressMatrix, kaldi::nnet3::kCopyRows, kaldi::nnet3::kCopyRowsMulti, kaldi::nnet3::kCopyToRowsMulti, kaldi::nnet3::kDeallocMatrix, kaldi::nnet3::kDecompressMatrix, kaldi::nnet3::kGotoLabel, kaldi::nnet3::kMatrixAdd, kaldi::nnet3::kMatrixCopy, kaldi::nnet3::kNoOperation, kaldi::nnet3::kNoOperationLabel, kaldi::nnet3::kNoOperationMarker, kaldi::nnet3::kNoOperationPermanent, kaldi::nnet3::kPropagate, kaldi::nnet3::kPropagateInPlace, kaldi::nnet3::kProvideOutput, kaldi::nnet3::kSetConst, kaldi::nnet3::kSimpleComponent, kaldi::nnet3::kSwapMatrix, kaldi::nnet3::kUpdatableComponent, kaldi::nnet3::kUsesMemo, ComputationChecker::nnet_, Nnet::NumComponents(), Component::OutputDim(), Component::Properties(), and NnetComputation::submatrices.
Referenced by ComputationChecker::Check().
|
private |
Definition at line 682 of file nnet-analyze.cc.
References ComputationChecker::a_, MatrixAccesses::accesses, MatrixAccesses::allocate_command, CheckComputationOptions::check_unused_variables, NnetComputation::commands, ComputationChecker::computation_, ComputationChecker::config_, MatrixAccesses::deallocate_command, MatrixAccesses::is_input, KALDI_ERR, KALDI_WARN, kaldi::nnet3::kSetConst, and Analyzer::matrix_accesses.
Referenced by ComputationChecker::Check().
|
private |
Checks for the situation where a read-only operation on a variable is followed by an operation that writes to the variable.
This should never occur prior to optimization, but after certain optimization we in effect "re-use" variables by doing things like propagate and backprop in-place, so this check shouldn't be performed after optimization.
Definition at line 598 of file nnet-analyze.cc.
References ComputationChecker::a_, CheckComputationOptions::check_unused_variables, ComputationChecker::config_, ComputationVariables::DescribeVariable(), KALDI_ERR, kaldi::nnet3::kReadAccess, Analyzer::variable_accesses, and Analyzer::variables.
Referenced by ComputationChecker::Check().
|
private |
Checks for the situation where a variable is read before being written.
Definition at line 636 of file nnet-analyze.cc.
References ComputationChecker::a_, CheckComputationOptions::check_unused_variables, NnetComputation::SubMatrixInfo::col_offset, NnetComputation::commands, ComputationChecker::computation_, ComputationChecker::config_, ComputationVariables::DescribeVariable(), KALDI_ERR, kaldi::nnet3::kCompressMatrix, kaldi::nnet3::kWriteAccess, NnetComputation::matrices, NnetComputation::SubMatrixInfo::matrix_index, NnetComputation::MatrixInfo::num_cols, NnetComputation::SubMatrixInfo::num_cols, NnetComputation::MatrixInfo::num_rows, NnetComputation::SubMatrixInfo::row_offset, Analyzer::variable_accesses, ComputationVariables::VariableInfo(), and Analyzer::variables.
Referenced by ComputationChecker::Check().
|
private |
|
private |
Definition at line 433 of file nnet-analyze.h.
Referenced by ComputationChecker::Check(), ComputationChecker::CheckComputationCompression(), ComputationChecker::CheckComputationDebugInfo(), ComputationChecker::CheckComputationIndexes(), ComputationChecker::CheckComputationMatrixAccesses(), ComputationChecker::CheckComputationUndefined(), ComputationAnalysis::DataInvalidatedCommand(), ComputationAnalysis::FirstAccess(), ComputationAnalysis::FirstNontrivialAccess(), ComputationAnalysis::FirstNontrivialMatrixAccess(), ComputationAnalysis::LastAccess(), ComputationAnalysis::LastMatrixAccess(), and ComputationAnalysis::LastWriteAccess().
|
private |
Definition at line 431 of file nnet-analyze.h.
Referenced by ComputationChecker::Check(), ComputationChecker::CheckComputationMatrixAccesses(), ComputationChecker::CheckComputationRewrite(), and ComputationChecker::CheckComputationUndefined().
|
private |
Definition at line 432 of file nnet-analyze.h.
Referenced by ComputationChecker::Check(), ComputationChecker::CheckComputationCompression(), and ComputationChecker::CheckComputationIndexes().