20 #ifndef KALDI_NNET_NNET_LOSS_H_ 21 #define KALDI_NNET_NNET_LOSS_H_ 42 loss_report_frames(5*3600*100)
46 opts->
Register(
"loss-report-frames", &loss_report_frames,
47 "Report loss per blocks of N frames (0 = no reports)");
71 virtual std::string Report() = 0;
86 frames_progress_(0.0),
87 xentropy_progress_(0.0),
88 entropy_progress_(0.0),
108 std::string Report();
111 std::string ReportPerClass();
115 if (frames_.Sum() == 0)
return 0.0;
116 return (xentropy_.Sum() - entropy_.Sum()) / frames_.Sum();
155 frames_progress_(0.0),
175 std::string Report();
179 if (frames_ == 0)
return 0.0;
180 return loss_ / frames_;
204 while (loss_vec_.size() > 0) {
205 delete loss_vec_.back();
206 loss_vec_.pop_back();
215 void InitFromString(
const std::string& s);
222 KALDI_ERR <<
"This is not supposed to be called!";
232 std::string Report();
250 #endif // KALDI_NNET_NNET_LOSS_H_ double xentropy_progress_
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
BaseFloat AvgLoss()
Get loss value (frame average),.
CuVector< double > frames_
CuMatrix< BaseFloat > frames_aux_
CuVector< BaseFloat > target_sum_
CuMatrix< BaseFloat > diff_pow_2_
CuMatrix< BaseFloat > tgt_mat_
std::vector< float > loss_vec_
CuVector< double > xentropy_
This class represents a matrix that's stored on the GPU if we have one, and in memory if not...
CuMatrix< BaseFloat > tgt_mat_
MultiTaskLoss(LossOptions &opts)
CuMatrix< BaseFloat > entropy_aux_
CuArray< int32 > max_id_out_
Vector< double > correct_
virtual void Register(const std::string &name, bool *ptr, const std::string &doc)=0
std::vector< BaseFloat > loss_weights_
std::vector< std::vector< std::pair< int32, BaseFloat > > > Posterior
Posterior is a typedef for storing acoustic-state (actually, transition-id) posteriors over an uttera...
void Eval(const VectorBase< BaseFloat > &frame_weights, const CuMatrixBase< BaseFloat > &net_out, const CuMatrixBase< BaseFloat > &target, CuMatrix< BaseFloat > *diff)
Evaluate mean square error using target-matrix,.
int32 loss_report_frames
Report loss value every 'report_interval' frames,.
BaseFloat AvgLoss()
Get loss value (frame average),.
CuMatrix< BaseFloat > tgt_mat_
std::vector< int32 > loss_dim_offset_
LossItf(LossOptions &opts)
CuVector< BaseFloat > frame_weights_
CuVector< double > entropy_
CuVector< BaseFloat > frame_weights_
CuMatrix< BaseFloat > xentropy_aux_
Matrix for CUDA computing.
CuArray< int32 > max_id_tgt_
std::vector< int32 > loss_dim_
std::vector< float > loss_vec_
std::vector< LossItf * > loss_vec_
void Register(OptionsItf *opts)
Provides a vector abstraction class.