21 #ifndef KALDI_NNET2_NNET_UPDATE_H_ 22 #define KALDI_NNET2_NNET_UPDATE_H_ 39 class NnetEnsembleTrainer;
53 Nnet *nnet_to_update);
59 double *tot_accuracy);
69 double *tot_accuracy);
78 void FormatInput(
const std::vector<NnetExample> &data);
88 double *tot_accuracy = NULL)
const;
122 const std::vector<NnetExample> &data,
136 const std::vector<NnetExample> &examples,
137 Nnet *nnet_to_update,
138 double *tot_accuracy = NULL);
148 const std::vector<NnetExample> &examples,
150 Nnet *nnet_to_update,
151 double *tot_accuracy = NULL);
164 const std::vector<NnetExample> &examples,
165 double *tot_accuracy= NULL);
173 const std::vector<NnetExample> &examples,
174 int32 minibatch_size,
175 double *tot_accuracy= NULL);
183 const std::vector<NnetExample> &examples,
191 #endif // KALDI_NNET2_NNET_UPDATE_H_ This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void Backprop(CuMatrix< BaseFloat > *deriv) const
Backprop must be called after ComputeObjfAndDeriv.
double ComputeNnetGradient(const Nnet &nnet, const std::vector< NnetExample > &validation_set, int32 batch_size, Nnet *gradient)
ComputeNnetGradient is mostly used to compute gradients on validation sets; it divides the example in...
This class represents a matrix that's stored on the GPU if we have one, and in memory if not...
double ComputeNnetObjf(const Nnet &nnet, const std::vector< NnetExample > &examples, double *tot_accuracy)
Computes objective function over a minibatch.
void FormatInput(const std::vector< NnetExample > &data)
Formats the input as a single matrix and sets the size of forward_data_, and sets up chunk_info_out_...
double DoBackprop(const Nnet &nnet, const std::vector< NnetExample > &examples, Nnet *nnet_to_update, double *tot_accuracy)
This function computes the objective function and either updates the model or adds to parameter gradi...
void FormatNnetInput(const Nnet &nnet, const std::vector< NnetExample > &data, Matrix< BaseFloat > *input_mat)
Takes the input to the nnet for a minibatch of examples, and formats as a single matrix.
std::vector< CuMatrix< BaseFloat > > forward_data_
double ComputeTotAccuracy(const std::vector< NnetExample > &data) const
BaseFloat TotalNnetTrainingWeight(const std::vector< NnetExample > &egs)
Returns the total weight summed over all the examples...
std::vector< ChunkInfo > chunk_info_out_
NnetUpdater(const Nnet &nnet, Nnet *nnet_to_update)
double ComputeForMinibatch(const std::vector< NnetExample > &data, double *tot_accuracy)
Does the entire forward and backward computation for this minbatch.
double ComputeObjfAndDeriv(const std::vector< NnetExample > &data, CuMatrix< BaseFloat > *deriv, double *tot_accuracy=NULL) const
Computes objective function and derivative at output layer, but does not do the backprop [for that...
void GetOutput(CuMatrix< BaseFloat > *output)