20 #ifndef KALDI_NNET3_NNET_CONVOLUTION_H_ 21 #define KALDI_NNET3_NNET_CONVOLUTION_H_ 52 namespace time_height_convolution {
141 else if (time_offset > other.
time_offset)
return false;
146 else if (time_offset > other.
time_offset)
return false;
226 bool Check(
bool check_heights_used =
true,
227 bool allow_height_padding =
true)
const;
232 std::string
Info()
const;
234 void Write(std::ostream &os,
bool binary)
const;
235 void Read(std::istream &is,
bool binary);
346 void Write(std::ostream &os,
bool binary)
const;
347 void Read(std::istream &is,
bool binary);
413 void Write(std::ostream &os,
bool binary)
const;
414 void Read(std::istream &is,
bool binary);
426 bool allow_extra_input =
false);
449 const std::vector<Index> &input_indexes,
450 const std::vector<Index> &output_indexes,
453 std::vector<Index> *input_indexes_modified,
454 std::vector<Index> *output_indexes_modified);
556 const std::vector<Index> &input_indexes,
557 const std::vector<Index> &output_indexes,
572 const std::vector<Index> &orig_input_indexes,
573 const std::vector<Index> &orig_output_indexes,
574 std::vector<Index> *input_indexes,
575 std::vector<Index> *output_indexes);
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
int32 height_subsample_out
std::vector< CuArray< int32 > > backward_columns
bool operator==(const Offset &other) const
void Write(std::ostream &os, bool binary) const
void ConvolveBackwardParams(const ConvolutionComputation &cc, const CuMatrixBase< BaseFloat > &input, const CuMatrixBase< BaseFloat > &output_deriv, BaseFloat alpha, CuMatrixBase< BaseFloat > *params_deriv)
This does the part of the backward derivative computation of convolution, that computes derivatives w...
bool Check(bool check_heights_used=true, bool allow_height_padding=true) const
This comment explains the basic framework used for everything related to time-height convolution...
bool columns_are_contiguous
std::set< int32 > all_time_offsets
std::vector< int32 > height_map
void GetIndexesForComputation(const ConvolutionComputationIo &io, const std::vector< Index > &orig_input_indexes, const std::vector< Index > &orig_output_indexes, std::vector< Index > *input_indexes, std::vector< Index > *output_indexes)
This function computes the reordered and possibly padded indexes corresponding to the computation in ...
void UnPadModelHeight(const ConvolutionComputationOptions &opts, const ConvolutionModel &model, const ConvolutionModel &model_padded, ConvolutionComputation *computation)
This function modifies, if necessary, a computation that has been built for the model 'model_padded'...
std::vector< ConvolutionStep > steps
void ConvolveBackwardData(const ConvolutionComputation &cc, const CuMatrixBase< BaseFloat > ¶ms, const CuMatrixBase< BaseFloat > &output_deriv, CuMatrixBase< BaseFloat > *input_deriv)
This does the part of the backward derivative computation of convolution, that propagates derivatives...
void MakeComputation(const ConvolutionModel &model, ConvolutionComputationIo &io, const ConvolutionComputationOptions &opts, ConvolutionComputation *computation)
void Read(std::istream &is, bool binary)
void AppendInputFrames(const ConvolutionModel &model, ConvolutionComputationIo *io, ConvolutionModel *model_appended, ConvolutionComputationIo *io_appended)
This function takes an input model and I/O specification, and it modifies both of them if necessary t...
void CompileConvolutionComputation(const ConvolutionModel &model, const std::vector< Index > &input_indexes, const std::vector< Index > &output_indexes, const ConvolutionComputationOptions &opts, ConvolutionComputation *computation, std::vector< Index > *input_indexes_modified, std::vector< Index > *output_indexes_modified)
This function does the compilation for a convolution computation; it's a wrapper for the functions be...
ConvolutionComputationOptions()
std::vector< Offset > offsets
void PadModelHeight(const ConvolutionModel &model, ConvolutionModel *model_padded)
This function takes a model that might require zero padding in the height dimension and outputs a mod...
This struct represents the structure of a convolution computation.
Matrix for CUDA computing.
void GetComputationIo(const std::vector< Index > &input_indexes, const std::vector< Index > &output_indexes, ConvolutionComputationIo *io)
This function takes lists of input and output indexes to a computation (e.g.
This struct contains options for compiling the convolutional computation.
std::set< int32 > required_time_offsets
int32 time_offsets_modulus
void ConvolveForward(const ConvolutionComputation &cc, const CuMatrixBase< BaseFloat > &input, const CuMatrixBase< BaseFloat > ¶ms, CuMatrixBase< BaseFloat > *output)
This does the forward computation of convolution.
void CheckModelAndIo(const ConvolutionModel &model, const ConvolutionComputationIo &io, bool allow_extra_input)
Check that this model and this I/O request are compatible in terms of required context, etc, and crash if not.
bool operator<(const Offset &other) const
void PadComputationInputTime(const ConvolutionModel &model, ConvolutionComputationIo *io)
This function extends the set of input indexes that the computation has, to account for any required ...
bool operator<=(const Offset &other) const