21 #ifndef KALDI_NNET3_NNET_COMPUTATION_H_ 22 #define KALDI_NNET3_NNET_COMPUTATION_H_ 60 void Print(std::ostream &os)
const { };
81 name(other.name), indexes(other.indexes), has_deriv(other.has_deriv) { }
83 bool has_deriv =
false):
84 name(name), indexes(indexes), has_deriv(has_deriv) { }
91 void Print(std::ostream &os)
const;
95 void Read(std::istream &istream,
bool binary);
97 void Write(std::ostream &ostream,
bool binary)
const;
133 store_component_stats(false) { }
137 bool NeedDerivatives()
const;
142 int32 IndexForInput(
const std::string &node_name)
const;
147 int32 IndexForOutput(
const std::string &node_name)
const;
151 void Print(std::ostream &os)
const;
153 void Read(std::istream &istream,
bool binary);
155 void Write(std::ostream &ostream,
bool binary)
const;
172 return (*cr1) == (*cr2);
311 num_rows(num_rows), num_cols(num_cols), stride_type(stride_type) {}
312 void Read(std::istream &istream,
bool binary);
313 void Write(std::ostream &ostream,
bool binary)
const;
320 void Read(std::istream &istream,
bool binary);
321 void Write(std::ostream &ostream,
bool binary)
const;
332 matrix_index(matrix_index), row_offset(row_offset), num_rows(num_rows),
333 col_offset(col_offset), num_cols(num_cols) {}
334 void Read(std::istream &istream,
bool binary);
335 void Write(std::ostream &ostream,
bool binary)
const;
353 command_type(command_type), alpha(1.0),
354 arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4), arg5(arg5), arg6(arg6),
360 command_type(command_type), alpha(alpha),
361 arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4), arg5(arg5), arg6(arg6),
363 void Read(std::istream &istream,
bool binary);
364 void Write(std::ostream &ostream,
bool binary)
const;
469 bool IsWholeMatrix(
int32 submatrix_index)
const;
474 void ComputeCudaIndexes();
478 void Print(std::ostream &os,
const Nnet &nnet)
const;
480 void Read(std::istream &istream,
bool binary);
481 void Write(std::ostream &ostream,
bool binary)
const;
486 void GetSubmatrixStrings(
const Nnet &nnet,
487 std::vector<std::string> *submat_strings)
const;
492 void GetWholeSubmatrices(std::vector<int32> *whole_submatrices)
const;
499 void GetCommandStrings(
const Nnet &nnet,
500 std::string *preamble,
501 std::vector<std::string> *command_strings)
const;
524 void Print(std::ostream& os)
const {
525 computation.
Print(os, nnet);
CommandType
CommandType is an enum that describes the category of the command used in the NnetComputation.
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
IoSpecification(const IoSpecification &other)
void Print(std::ostream &os) const
Command(CommandType command_type=kNoOperationMarker, int32 arg1=-1, int32 arg2=-1, int32 arg3=-1, int32 arg4=-1, int32 arg5=-1, int32 arg6=-1, int32 arg7=-1)
bool store_component_stats
you should set need_component_stats to true if you need the average-activation and average-derivative...
std::vector< MatrixDebugInfo > matrix_debug_info
std::vector< Index > input_indexes
bool need_model_derivative
if need_model_derivative is true, then we'll be doing either model training or model-derivative compu...
MiscComputationInfo misc_info
misc_info is for extensibility to things that don't easily fit into the framework.
void Print(std::ostream &os, const Nnet &nnet) const
std::ostream & operator<<(std::ostream &ostream, const Index &index)
std::vector< IoSpecification > inputs
std::vector< MatrixInfo > matrices
void NnetComputation(const Nnet &nnet, const CuMatrixBase< BaseFloat > &input, bool pad_input, CuMatrixBase< BaseFloat > *output)
Does the basic neural net computation, on a sequence of data (e.g.
std::vector< Command > commands
Command(BaseFloat alpha, CommandType command_type=kNoOperationMarker, int32 arg1=-1, int32 arg2=-1, int32 arg3=-1, int32 arg4=-1, int32 arg5=-1, int32 arg6=-1, int32 arg7=-1)
MatrixStrideType stride_type
ComponentPrecomputedIndexes * data
std::vector< CuArray< int32 > > indexes_cuda
bool need_model_derivative
std::vector< std::vector< std::pair< int32, int32 > > > indexes_multi
std::vector< Cindex > cindexes
const NnetComputation & computation
std::vector< SubMatrixInfo > submatrices
std::vector< CuArray< Int32Pair > > indexes_ranges_cuda
std::vector< Index > output_indexes
SubMatrixInfo(int32 matrix_index, int32 row_offset, int32 num_rows, int32 col_offset, int32 num_cols)
std::vector< PrecomputedIndexesInfo > component_precomputed_indexes
bool operator==(const MiscComputationInfo &other) const
std::vector< Index > indexes
std::vector< IoSpecification > outputs
IoSpecification(const std::string &name, const std::vector< Index > &indexes, bool has_deriv=false)
std::vector< std::vector< int32 > > indexes
void Print(std::ostream &os) const
MatrixInfo(int32 num_rows, int32 num_cols, MatrixStrideType stride_type)
std::vector< std::vector< std::pair< int32, int32 > > > indexes_ranges