FramePoolingComponent : The input/output matrices are split to frames of width 'feature_dim_'. More...
#include <nnet-frame-pooling-component.h>


Public Member Functions | |
| FramePoolingComponent (int32 dim_in, int32 dim_out) | |
| ~FramePoolingComponent () | |
| Component * | Copy () const | 
| Copy component (deep copy),.  More... | |
| ComponentType | GetType () const | 
| Get Type Identification of the component,.  More... | |
| void | InitData (std::istream &is) | 
| Here the offsets are w.r.t.  More... | |
| void | ReadData (std::istream &is, bool binary) | 
| Here the offsets are w.r.t.  More... | |
| void | WriteData (std::ostream &os, bool binary) const | 
| Writes the component content.  More... | |
| int32 | NumParams () const | 
| Number of trainable parameters,.  More... | |
| void | GetGradient (VectorBase< BaseFloat > *gradient) const | 
| Get gradient reshaped as a vector,.  More... | |
| void | GetParams (VectorBase< BaseFloat > *params) const | 
| Get the trainable parameters reshaped as a vector,.  More... | |
| void | SetParams (const VectorBase< BaseFloat > ¶ms) | 
| Set the trainable parameters from, reshaped as a vector,.  More... | |
| std::string | Info () const | 
| Print some additional info (after <ComponentName> and the dims),.  More... | |
| std::string | InfoGradient () const | 
| Print some additional info about gradient (after <...> and dims),.  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 | Update (const CuMatrixBase< BaseFloat > &input, const CuMatrixBase< BaseFloat > &diff) | 
| Compute gradient and update parameters,.  More... | |
  Public Member Functions inherited from UpdatableComponent | |
| UpdatableComponent (int32 input_dim, int32 output_dim) | |
| virtual | ~UpdatableComponent () | 
| bool | IsUpdatable () const | 
| Check if contains trainable parameters,.  More... | |
| virtual void | SetTrainOptions (const NnetTrainOptions &opts) | 
| Set the training options to the component,.  More... | |
| const NnetTrainOptions & | GetTrainOptions () const | 
| Get the training options from the component,.  More... | |
| virtual void | SetLearnRateCoef (BaseFloat val) | 
| Set the learn-rate coefficient,.  More... | |
| virtual void | SetBiasLearnRateCoef (BaseFloat val) | 
| Set the learn-rate coefficient for bias,.  More... | |
  Public Member Functions inherited from Component | |
| Component (int32 input_dim, int32 output_dim) | |
| Generic interface of a component,.  More... | |
| virtual | ~Component () | 
| 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... | |
Private Attributes | |
| int32 | feature_dim_ | 
| std::vector< int32 > | offset_ | 
| std::vector< Vector< BaseFloat > > | weight_ | 
| Vector of pooling weight vectors,.  More... | |
| std::vector< Vector< BaseFloat > > | weight_diff_ | 
| detivatives of weight vectors,  More... | |
| bool | normalize_ | 
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 Attributes inherited from UpdatableComponent | |
| NnetTrainOptions | opts_ | 
| Option-class with training hyper-parameters,.  More... | |
| BaseFloat | learn_rate_coef_ | 
| Scalar applied to learning rate for weight matrices (to be used in ::Update method),.  More... | |
| BaseFloat | bias_learn_rate_coef_ | 
| Scalar applied to learning rate for bias (to be used in ::Update method),.  More... | |
  Protected Attributes inherited from Component | |
| int32 | input_dim_ | 
| Data members,.  More... | |
| int32 | output_dim_ | 
| Dimension of the output of the Component,.  More... | |
FramePoolingComponent : The input/output matrices are split to frames of width 'feature_dim_'.
Here we do weighted pooling of frames along the temporal axis, given a frame-offset of leftmost frame, the pool-size is defined by weight-vector size.
Definition at line 43 of file nnet-frame-pooling-component.h.
      
  | 
  inline | 
Definition at line 45 of file nnet-frame-pooling-component.h.
Referenced by FramePoolingComponent::Copy().
      
  | 
  inline | 
Definition at line 51 of file nnet-frame-pooling-component.h.
      
  | 
  inlinevirtual | 
Backward pass transformation (to be implemented by descending class...)
Implements Component.
Definition at line 233 of file nnet-frame-pooling-component.h.
References KALDI_ERR.
      
  | 
  inlinevirtual | 
Copy component (deep copy),.
Implements Component.
Definition at line 54 of file nnet-frame-pooling-component.h.
References FramePoolingComponent::FramePoolingComponent().
      
  | 
  inlinevirtual | 
Get gradient reshaped as a vector,.
Implements UpdatableComponent.
Definition at line 175 of file nnet-frame-pooling-component.h.
References KALDI_ERR.
      
  | 
  inlinevirtual | 
Get the trainable parameters reshaped as a vector,.
Implements UpdatableComponent.
Definition at line 179 of file nnet-frame-pooling-component.h.
References VectorBase< Real >::Dim(), KALDI_ASSERT, FramePoolingComponent::NumParams(), VectorBase< Real >::Range(), and FramePoolingComponent::weight_.
      
  | 
  inlinevirtual | 
Get Type Identification of the component,.
Implements Component.
Definition at line 55 of file nnet-frame-pooling-component.h.
References Component::kFramePoolingComponent.
      
  | 
  inlinevirtual | 
Print some additional info (after <ComponentName> and the dims),.
Reimplemented from Component.
Definition at line 193 of file nnet-frame-pooling-component.h.
References FramePoolingComponent::offset_, and FramePoolingComponent::weight_.
      
  | 
  inlinevirtual | 
Print some additional info about gradient (after <...> and dims),.
Reimplemented from Component.
Definition at line 202 of file nnet-frame-pooling-component.h.
References UpdatableComponent::learn_rate_coef_, FramePoolingComponent::offset_, kaldi::nnet1::ToString(), and FramePoolingComponent::weight_diff_.
      
  | 
  inlinevirtual | 
Here the offsets are w.r.t.
central frames, which has offset 0. Note.: both the offsets and pool sizes can be negative.
Implements UpdatableComponent.
Definition at line 61 of file nnet-frame-pooling-component.h.
References VectorBase< Real >::Dim(), FramePoolingComponent::feature_dim_, Component::InputDim(), KALDI_ASSERT, KALDI_ERR, KALDI_LOG, UpdatableComponent::learn_rate_coef_, FramePoolingComponent::normalize_, FramePoolingComponent::offset_, VectorBase< Real >::Range(), Vector< Real >::Read(), kaldi::ReadBasicType(), kaldi::ReadIntegerVector(), kaldi::ReadToken(), and FramePoolingComponent::weight_.
      
  | 
  inlinevirtual | 
Number of trainable parameters,.
Implements UpdatableComponent.
Definition at line 167 of file nnet-frame-pooling-component.h.
References FramePoolingComponent::weight_.
Referenced by FramePoolingComponent::GetParams().
      
  | 
  inlinevirtual | 
Abstract interface for propagation/backpropagation.
Forward pass transformation (to be implemented by descending class...)
Implements Component.
Definition at line 216 of file nnet-frame-pooling-component.h.
References CuMatrixBase< Real >::ColRange(), FramePoolingComponent::feature_dim_, rnnlm::i, KALDI_ASSERT, CuMatrixBase< Real >::NumCols(), FramePoolingComponent::offset_, CuMatrixBase< Real >::SetZero(), and FramePoolingComponent::weight_.
      
  | 
  inlinevirtual | 
Here the offsets are w.r.t.
leftmost frame from splice, its offset is 0. If we spliced +/- 15 frames, the central frames has index '15'.
Reimplemented from Component.
Definition at line 116 of file nnet-frame-pooling-component.h.
References kaldi::ExpectToken(), FramePoolingComponent::feature_dim_, Component::input_dim_, Component::InputDim(), KALDI_ASSERT, UpdatableComponent::learn_rate_coef_, FramePoolingComponent::normalize_, FramePoolingComponent::offset_, Component::output_dim_, kaldi::ReadBasicType(), kaldi::ReadIntegerVector(), and FramePoolingComponent::weight_.
      
  | 
  inlinevirtual | 
Set the trainable parameters from, reshaped as a vector,.
Implements UpdatableComponent.
Definition at line 189 of file nnet-frame-pooling-component.h.
References KALDI_ERR.
      
  | 
  inlinevirtual | 
Compute gradient and update parameters,.
Implements UpdatableComponent.
Definition at line 241 of file nnet-frame-pooling-component.h.
References CuMatrixBase< Real >::ColRange(), FramePoolingComponent::feature_dim_, rnnlm::i, kaldi::kSetZero, NnetTrainOptions::learn_rate, UpdatableComponent::learn_rate_coef_, CuMatrixBase< Real >::MulElements(), FramePoolingComponent::normalize_, FramePoolingComponent::offset_, UpdatableComponent::opts_, CuMatrixBase< Real >::Sum(), FramePoolingComponent::weight_, and FramePoolingComponent::weight_diff_.
      
  | 
  inlinevirtual | 
Writes the component content.
Reimplemented from Component.
Definition at line 150 of file nnet-frame-pooling-component.h.
References FramePoolingComponent::feature_dim_, UpdatableComponent::learn_rate_coef_, FramePoolingComponent::normalize_, FramePoolingComponent::offset_, FramePoolingComponent::weight_, kaldi::WriteBasicType(), kaldi::WriteIntegerVector(), and kaldi::WriteToken().
      
  | 
  private | 
Definition at line 277 of file nnet-frame-pooling-component.h.
Referenced by FramePoolingComponent::InitData(), FramePoolingComponent::PropagateFnc(), FramePoolingComponent::ReadData(), FramePoolingComponent::Update(), and FramePoolingComponent::WriteData().
      
  | 
  private | 
Definition at line 284 of file nnet-frame-pooling-component.h.
Referenced by FramePoolingComponent::InitData(), FramePoolingComponent::ReadData(), FramePoolingComponent::Update(), and FramePoolingComponent::WriteData().
      
  | 
  private | 
Definition at line 278 of file nnet-frame-pooling-component.h.
Referenced by FramePoolingComponent::Info(), FramePoolingComponent::InfoGradient(), FramePoolingComponent::InitData(), FramePoolingComponent::PropagateFnc(), FramePoolingComponent::ReadData(), FramePoolingComponent::Update(), and FramePoolingComponent::WriteData().
Vector of pooling weight vectors,.
Definition at line 280 of file nnet-frame-pooling-component.h.
Referenced by FramePoolingComponent::GetParams(), FramePoolingComponent::Info(), FramePoolingComponent::InitData(), FramePoolingComponent::NumParams(), FramePoolingComponent::PropagateFnc(), FramePoolingComponent::ReadData(), FramePoolingComponent::Update(), and FramePoolingComponent::WriteData().
detivatives of weight vectors,
Definition at line 282 of file nnet-frame-pooling-component.h.
Referenced by FramePoolingComponent::InfoGradient(), and FramePoolingComponent::Update().