UpdateWClass Class Reference

#include <estimate-am-sgmm2.h>

Inheritance diagram for UpdateWClass:
Collaboration diagram for UpdateWClass:

Public Member Functions

 UpdateWClass (const MleAmSgmm2Accs &accs, const AmSgmm2 &model, const Matrix< double > &w, const std::vector< Matrix< double > > &log_a, Matrix< double > *F_i, Matrix< double > *g_i, double *tot_like)
 
 UpdateWClass (const UpdateWClass &other)
 
 ~UpdateWClass ()
 
void operator() ()
 
- Public Member Functions inherited from MultiThreadable
virtual ~MultiThreadable ()
 

Private Attributes

const MleAmSgmm2Accsaccs_
 
const AmSgmm2model_
 
const Matrix< double > & w_
 
const std::vector< Matrix< double > > & log_a_
 
Matrix< double > * F_i_ptr_
 
Matrix< double > * g_i_ptr_
 
Matrix< double > F_i_
 
Matrix< double > g_i_
 
double * tot_like_ptr_
 
double tot_like_
 

Additional Inherited Members

- Public Attributes inherited from MultiThreadable
int32 thread_id_
 
int32 num_threads_
 

Detailed Description

Definition at line 425 of file estimate-am-sgmm2.h.

Constructor & Destructor Documentation

◆ UpdateWClass() [1/2]

UpdateWClass ( const MleAmSgmm2Accs accs,
const AmSgmm2 model,
const Matrix< double > &  w,
const std::vector< Matrix< double > > &  log_a,
Matrix< double > *  F_i,
Matrix< double > *  g_i,
double *  tot_like 
)
inline

Definition at line 427 of file estimate-am-sgmm2.h.

References MatrixBase< Real >::NumCols(), and MatrixBase< Real >::NumRows().

433  :
434  accs_(accs), model_(model), w_(w), log_a_(log_a),
435  F_i_ptr_(F_i), g_i_ptr_(g_i), tot_like_ptr_(tot_like) {
436  tot_like_ = 0.0;
437  F_i_.Resize(F_i->NumRows(), F_i->NumCols());
438  g_i_.Resize(g_i->NumRows(), g_i->NumCols());
439  }
Matrix< double > g_i_
const AmSgmm2 & model_
Matrix< double > * F_i_ptr_
const std::vector< Matrix< double > > & log_a_
Matrix< double > F_i_
Matrix< double > * g_i_ptr_
const Matrix< double > & w_
const MleAmSgmm2Accs & accs_
void Resize(const MatrixIndexT r, const MatrixIndexT c, MatrixResizeType resize_type=kSetZero, MatrixStrideType stride_type=kDefaultStride)
Sets matrix to a specified size (zero is OK as long as both r and c are zero).

◆ UpdateWClass() [2/2]

UpdateWClass ( const UpdateWClass other)
inline

Definition at line 441 of file estimate-am-sgmm2.h.

441  :
442  MultiThreadable(other),
443  accs_(other.accs_), model_(other.model_), w_(other.w_),
444  log_a_(other.log_a_), F_i_ptr_(other.F_i_ptr_), g_i_ptr_(other.g_i_ptr_),
445  F_i_(other.F_i_), g_i_(other.g_i_), tot_like_ptr_(other.tot_like_ptr_),
446  tot_like_(0.0) { }
Matrix< double > g_i_
const AmSgmm2 & model_
Matrix< double > * F_i_ptr_
const std::vector< Matrix< double > > & log_a_
Matrix< double > F_i_
Matrix< double > * g_i_ptr_
const Matrix< double > & w_
const MleAmSgmm2Accs & accs_

◆ ~UpdateWClass()

~UpdateWClass ( )
inline

Definition at line 448 of file estimate-am-sgmm2.h.

References kaldi::kNoTrans.

448  {
449  F_i_ptr_->AddMat(1.0, F_i_, kNoTrans);
450  g_i_ptr_->AddMat(1.0, g_i_, kNoTrans);
452  }
Matrix< double > g_i_
void AddMat(const Real alpha, const MatrixBase< Real > &M, MatrixTransposeType transA=kNoTrans)
*this += alpha * M [or M^T]
Matrix< double > * F_i_ptr_
Matrix< double > F_i_
Matrix< double > * g_i_ptr_

Member Function Documentation

◆ operator()()

void operator() ( )
inlinevirtual

Implements MultiThreadable.

Definition at line 454 of file estimate-am-sgmm2.h.

References MleAmSgmm2Updater::UpdateWGetStats().

454  {
455  // Note: give them local copy of the sums we're computing,
456  // which will be propagated to the total sums in the destructor.
458  &F_i_, &g_i_, &tot_like_,
460  }
Matrix< double > g_i_
static void UpdateWGetStats(const MleAmSgmm2Accs &accs, const AmSgmm2 &model, const Matrix< double > &w, const std::vector< Matrix< double > > &log_a, Matrix< double > *F_i, Matrix< double > *g_i, double *tot_like, int32 num_threads, int32 thread_id)
Called, multithreaded, inside UpdateW.
const AmSgmm2 & model_
const std::vector< Matrix< double > > & log_a_
Matrix< double > F_i_
const Matrix< double > & w_
const MleAmSgmm2Accs & accs_

Member Data Documentation

◆ accs_

const MleAmSgmm2Accs& accs_
private

Definition at line 462 of file estimate-am-sgmm2.h.

◆ F_i_

Matrix<double> F_i_
private

Definition at line 468 of file estimate-am-sgmm2.h.

◆ F_i_ptr_

Matrix<double>* F_i_ptr_
private

Definition at line 466 of file estimate-am-sgmm2.h.

◆ g_i_

Matrix<double> g_i_
private

Definition at line 469 of file estimate-am-sgmm2.h.

◆ g_i_ptr_

Matrix<double>* g_i_ptr_
private

Definition at line 467 of file estimate-am-sgmm2.h.

◆ log_a_

const std::vector<Matrix<double> >& log_a_
private

Definition at line 465 of file estimate-am-sgmm2.h.

◆ model_

const AmSgmm2& model_
private

Definition at line 463 of file estimate-am-sgmm2.h.

◆ tot_like_

double tot_like_
private

Definition at line 471 of file estimate-am-sgmm2.h.

◆ tot_like_ptr_

double* tot_like_ptr_
private

Definition at line 470 of file estimate-am-sgmm2.h.

◆ w_

const Matrix<double>& w_
private

Definition at line 464 of file estimate-am-sgmm2.h.


The documentation for this class was generated from the following file: