#include <nnet-kl-hmm.h>
Public Member Functions | |
KlHmm (int32 dim_in, int32 dim_out) | |
~KlHmm () | |
Component * | Copy () const |
Copy component (deep copy),. More... | |
ComponentType | GetType () const |
Get Type Identification of the component,. More... | |
void | PropagateFnc (const CuMatrixBase< BaseFloat > &in, CuMatrixBase< BaseFloat > *out) |
Abstract interface for propagation/backpropagation. More... | |
void | BackpropagateFnc (const CuMatrixBase< BaseFloat > &in, const CuMatrixBase< BaseFloat > &out, const CuMatrixBase< BaseFloat > &out_diff, CuMatrixBase< BaseFloat > *in_diff) |
Backward pass transformation (to be implemented by descending class...) More... | |
void | ReadData (std::istream &is, bool binary) |
Reads the component content. More... | |
void | WriteData (std::ostream &os, bool binary) const |
Writes the component content. More... | |
void | SetStats (const Matrix< BaseFloat > mat) |
Set the statistics matrix. More... | |
void | Accumulate (const Matrix< BaseFloat > &posteriors, const std::vector< int32 > &alignment) |
Accumulate the statistics for KL-HMM paramter estimation,. More... | |
Public Member Functions inherited from Component | |
Component (int32 input_dim, int32 output_dim) | |
Generic interface of a component,. More... | |
virtual | ~Component () |
virtual bool | IsUpdatable () const |
Check if componeny has 'Updatable' interface (trainable components),. More... | |
virtual bool | IsMultistream () const |
Check if component has 'Recurrent' interface (trainable and recurrent),. More... | |
int32 | InputDim () const |
Get the dimension of the input,. More... | |
int32 | OutputDim () const |
Get the dimension of the output,. More... | |
void | Propagate (const CuMatrixBase< BaseFloat > &in, CuMatrix< BaseFloat > *out) |
Perform forward-pass propagation 'in' -> 'out',. More... | |
void | Backpropagate (const CuMatrixBase< BaseFloat > &in, const CuMatrixBase< BaseFloat > &out, const CuMatrixBase< BaseFloat > &out_diff, CuMatrix< BaseFloat > *in_diff) |
Perform backward-pass propagation 'out_diff' -> 'in_diff'. More... | |
void | Write (std::ostream &os, bool binary) const |
Write the component to a stream,. More... | |
virtual std::string | Info () const |
Print some additional info (after <ComponentName> and the dims),. More... | |
virtual std::string | InfoGradient () const |
Print some additional info about gradient (after <...> and dims),. More... | |
Private Attributes | |
Matrix< double > | kl_stats_ |
CuMatrix< BaseFloat > | kl_inv_q_ |
Additional Inherited Members | |
Public Types inherited from Component | |
enum | ComponentType { kUnknown = 0x0, kUpdatableComponent = 0x0100, kAffineTransform, kLinearTransform, kConvolutionalComponent, kLstmProjected, kBlstmProjected, kRecurrentComponent, kActivationFunction = 0x0200, kSoftmax, kHiddenSoftmax, kBlockSoftmax, kSigmoid, kTanh, kParametricRelu, kDropout, kLengthNormComponent, kTranform = 0x0400, kRbm, kSplice, kCopy, kTranspose, kBlockLinearity, kAddShift, kRescale, kKlHmm = 0x0800, kSentenceAveragingComponent, kSimpleSentenceAveragingComponent, kAveragePoolingComponent, kMaxPoolingComponent, kFramePoolingComponent, kParallelComponent, kMultiBasisComponent } |
Component type identification mechanism,. More... | |
Static Public Member Functions inherited from Component | |
static const char * | TypeToMarker (ComponentType t) |
Converts component type to marker,. More... | |
static ComponentType | MarkerToType (const std::string &s) |
Converts marker to component type (case insensitive),. More... | |
static Component * | Init (const std::string &conf_line) |
Initialize component from a line in config file,. More... | |
static Component * | Read (std::istream &is, bool binary) |
Read the component from a stream (static method),. More... | |
Static Public Attributes inherited from Component | |
static const struct key_value | kMarkerMap [] |
The table with pairs of Component types and markers (defined in nnet-component.cc),. More... | |
Protected Member Functions inherited from Component | |
virtual void | InitData (std::istream &is) |
Virtual interface for initialization and I/O,. More... | |
Protected Attributes inherited from Component | |
int32 | input_dim_ |
Data members,. More... | |
int32 | output_dim_ |
Dimension of the output of the Component,. More... | |
Definition at line 37 of file nnet-kl-hmm.h.
Definition at line 39 of file nnet-kl-hmm.h.
Referenced by KlHmm::Copy().
|
inline |
Definition at line 44 of file nnet-kl-hmm.h.
|
inline |
Accumulate the statistics for KL-HMM paramter estimation,.
Definition at line 133 of file nnet-kl-hmm.h.
References rnnlm::i, KALDI_ASSERT, KlHmm::kl_stats_, MatrixBase< Real >::NumCols(), MatrixBase< Real >::NumRows(), and MatrixBase< Real >::Row().
|
inlinevirtual |
Backward pass transformation (to be implemented by descending class...)
Implements Component.
Definition at line 105 of file nnet-kl-hmm.h.
References KALDI_ERR.
|
inlinevirtual |
Copy component (deep copy),.
Implements Component.
Definition at line 47 of file nnet-kl-hmm.h.
References KlHmm::KlHmm().
|
inlinevirtual |
Get Type Identification of the component,.
Implements Component.
Definition at line 48 of file nnet-kl-hmm.h.
References Component::kKlHmm.
|
inlinevirtual |
Abstract interface for propagation/backpropagation.
Forward pass transformation (to be implemented by descending class...)
Implements Component.
Definition at line 50 of file nnet-kl-hmm.h.
References CuVectorBase< Real >::AddColSumMat(), VectorBase< Real >::AddColSumMat(), CuMatrixBase< Real >::AddMatMat(), CuMatrixBase< Real >::AddVecToCols(), MatrixBase< Real >::ApplyFloor(), MatrixBase< Real >::ApplyLog(), kaldi::ApproxEqual(), CuMatrixBase< Real >::CopyFromMat(), CuMatrixBase< Real >::CopyToMat(), MatrixBase< Real >::InvertElements(), KALDI_ASSERT, KlHmm::kl_inv_q_, KlHmm::kl_stats_, kaldi::kNoTrans, kaldi::kSetZero, kaldi::kTrans, CuMatrixBase< Real >::MulElements(), MatrixBase< Real >::MulRowsVec(), MatrixBase< Real >::NumCols(), CuMatrixBase< Real >::NumCols(), MatrixBase< Real >::NumRows(), CuMatrixBase< Real >::NumRows(), and CuMatrixBase< Real >::Scale().
|
inlinevirtual |
Reads the component content.
Reimplemented from Component.
Definition at line 113 of file nnet-kl-hmm.h.
References Component::input_dim_, KALDI_ASSERT, KlHmm::kl_stats_, MatrixBase< Real >::NumCols(), MatrixBase< Real >::NumRows(), Component::output_dim_, and Matrix< Real >::Read().
Set the statistics matrix.
Definition at line 125 of file nnet-kl-hmm.h.
References MatrixBase< Real >::CopyFromMat(), Component::input_dim_, KALDI_ASSERT, KlHmm::kl_stats_, MatrixBase< Real >::NumCols(), MatrixBase< Real >::NumRows(), Component::output_dim_, and Matrix< Real >::Resize().
|
inlinevirtual |
Writes the component content.
Reimplemented from Component.
Definition at line 120 of file nnet-kl-hmm.h.
References KlHmm::kl_stats_, and MatrixBase< Real >::Write().
Definition at line 148 of file nnet-kl-hmm.h.
Referenced by KlHmm::PropagateFnc().
|
private |
Definition at line 147 of file nnet-kl-hmm.h.
Referenced by KlHmm::Accumulate(), KlHmm::PropagateFnc(), KlHmm::ReadData(), KlHmm::SetStats(), and KlHmm::WriteData().