FramePoolingComponent Class Reference

FramePoolingComponent : The input/output matrices are split to frames of width 'feature_dim_'. More...

#include <nnet-frame-pooling-component.h>

Inheritance diagram for FramePoolingComponent:
Collaboration diagram for FramePoolingComponent:

Public Member Functions

 FramePoolingComponent (int32 dim_in, int32 dim_out)
 
 ~FramePoolingComponent ()
 
ComponentCopy () 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 > &params)
 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 NnetTrainOptionsGetTrainOptions () 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< int32offset_
 
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 ComponentInit (const std::string &conf_line)
 Initialize component from a line in config file,. More...
 
static ComponentRead (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FramePoolingComponent()

FramePoolingComponent ( int32  dim_in,
int32  dim_out 
)
inline

Definition at line 45 of file nnet-frame-pooling-component.h.

Referenced by FramePoolingComponent::Copy().

45  :
46  UpdatableComponent(dim_in, dim_out),
47  feature_dim_(0),
48  normalize_(false)
49  { }
UpdatableComponent(int32 input_dim, int32 output_dim)

◆ ~FramePoolingComponent()

~FramePoolingComponent ( )
inline

Definition at line 51 of file nnet-frame-pooling-component.h.

52  { }

Member Function Documentation

◆ BackpropagateFnc()

void BackpropagateFnc ( const CuMatrixBase< BaseFloat > &  in,
const CuMatrixBase< BaseFloat > &  out,
const CuMatrixBase< BaseFloat > &  out_diff,
CuMatrixBase< BaseFloat > *  in_diff 
)
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.

236  {
237  KALDI_ERR << "Unimplemented.";
238  }
#define KALDI_ERR
Definition: kaldi-error.h:147

◆ Copy()

Component* Copy ( ) const
inlinevirtual

Copy component (deep copy),.

Implements Component.

Definition at line 54 of file nnet-frame-pooling-component.h.

References FramePoolingComponent::FramePoolingComponent().

54 { return new FramePoolingComponent(*this); }
FramePoolingComponent(int32 dim_in, int32 dim_out)

◆ GetGradient()

void GetGradient ( VectorBase< BaseFloat > *  gradient) const
inlinevirtual

Get gradient reshaped as a vector,.

Implements UpdatableComponent.

Definition at line 175 of file nnet-frame-pooling-component.h.

References KALDI_ERR.

175  {
176  KALDI_ERR << "Unimplemented.";
177  }
#define KALDI_ERR
Definition: kaldi-error.h:147

◆ GetParams()

void GetParams ( VectorBase< BaseFloat > *  params) const
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_.

179  {
180  KALDI_ASSERT(params->Dim() == NumParams());
181  int32 offset = 0;
182  for (int32 p = 0; p < weight_.size(); p++) {
183  params->Range(offset, weight_[p].Dim()).CopyFromVec(weight_[p]);
184  offset += weight_[p].Dim();
185  }
186  KALDI_ASSERT(offset == params->Dim());
187  }
kaldi::int32 int32
std::vector< Vector< BaseFloat > > weight_
Vector of pooling weight vectors,.
int32 NumParams() const
Number of trainable parameters,.
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:185

◆ GetType()

ComponentType GetType ( ) const
inlinevirtual

Get Type Identification of the component,.

Implements Component.

Definition at line 55 of file nnet-frame-pooling-component.h.

References Component::kFramePoolingComponent.

◆ Info()

std::string Info ( ) const
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_.

193  {
194  std::ostringstream oss;
195  oss << "\n (offset,weights) : ";
196  for (int32 p = 0; p < weight_.size(); p++) {
197  oss << "(" << offset_[p] << "," << weight_[p] << "), ";
198  }
199  return oss.str();
200  }
kaldi::int32 int32
std::vector< Vector< BaseFloat > > weight_
Vector of pooling weight vectors,.

◆ InfoGradient()

std::string InfoGradient ( ) const
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_.

202  {
203  std::ostringstream oss;
204  oss << "\n lr-coef " << ToString(learn_rate_coef_);
205  oss << "\n (offset,weights_grad) : ";
206  for (int32 p = 0; p < weight_diff_.size(); p++) {
207  oss << "(" << offset_[p] << ",";
208  // pass the weight vector, remove '\n' as last char
209  oss << weight_diff_[p];
210  oss.seekp(-1, std::ios_base::cur);
211  oss << "), ";
212  }
213  return oss.str();
214  }
std::string ToString(const T &t)
Convert basic type to a string (please don&#39;t overuse),.
Definition: nnet-utils.h:52
BaseFloat learn_rate_coef_
Scalar applied to learning rate for weight matrices (to be used in ::Update method),.
kaldi::int32 int32
std::vector< Vector< BaseFloat > > weight_diff_
detivatives of weight vectors,

◆ InitData()

void InitData ( std::istream &  is)
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_.

61  {
62  // temporary, for initialization,
63  std::vector<int32> pool_size;
64  std::vector<int32> central_offset;
65  Vector<BaseFloat> pool_weight;
66  float learn_rate_coef = 0.01;
67  // parse config
68  std::string token;
69  while (is >> std::ws, !is.eof()) {
70  ReadToken(is, false, &token);
71  if (token == "<FeatureDim>") ReadBasicType(is, false, &feature_dim_);
72  else if (token == "<CentralOffset>") ReadIntegerVector(is, false, &central_offset);
73  else if (token == "<PoolSize>") ReadIntegerVector(is, false, &pool_size);
74  else if (token == "<PoolWeight>") pool_weight.Read(is, false);
75  else if (token == "<LearnRateCoef>") ReadBasicType(is, false, &learn_rate_coef);
76  else if (token == "<Normalize>") ReadBasicType(is, false, &normalize_);
77  else KALDI_ERR << "Unknown token " << token << ", a typo in config?"
78  << " (FeatureDim|CentralOffset <vec>|PoolSize <vec>|LearnRateCoef|Normalize)";
79  }
80  // check inputs:
82  KALDI_ASSERT(central_offset.size() > 0);
83  KALDI_ASSERT(central_offset.size() == pool_size.size());
84  // initialize:
85  int32 num_frames = InputDim() / feature_dim_;
86  int32 central_frame = (num_frames -1) / 2;
87  int32 num_pools = central_offset.size();
88  offset_.resize(num_pools);
89  weight_.resize(num_pools);
90  for (int32 p = 0; p < num_pools; p++) {
91  offset_[p] = central_frame + central_offset[p] + std::min(0, pool_size[p]+1);
92  weight_[p].Resize(std::abs(pool_size[p]));
93  weight_[p].Set(1.0/std::abs(pool_size[p]));
94  }
95  learn_rate_coef_ = learn_rate_coef;
96  if (pool_weight.Dim() != 0) {
97  KALDI_LOG << "Initializing from pool-weight vector";
98  int32 num_weights = 0;
99  for (int32 p = 0; p < num_pools; p++) {
100  weight_[p].CopyFromVec(pool_weight.Range(num_weights, weight_[p].Dim()));
101  num_weights += weight_[p].Dim();
102  }
103  KALDI_ASSERT(num_weights == pool_weight.Dim());
104  }
105  // check that offsets are within the splice we had,
106  for (int32 p = 0; p < num_pools; p++) {
107  KALDI_ASSERT(offset_[p] >= 0);
108  KALDI_ASSERT(offset_[p] + weight_[p].Dim() <= num_frames);
109  }
110  }
void ReadBasicType(std::istream &is, bool binary, T *t)
ReadBasicType is the name of the read function for bool, integer types, and floating-point types...
Definition: io-funcs-inl.h:55
BaseFloat learn_rate_coef_
Scalar applied to learning rate for weight matrices (to be used in ::Update method),.
kaldi::int32 int32
void ReadToken(std::istream &is, bool binary, std::string *str)
ReadToken gets the next token and puts it in str (exception on failure).
Definition: io-funcs.cc:154
std::vector< Vector< BaseFloat > > weight_
Vector of pooling weight vectors,.
void ReadIntegerVector(std::istream &is, bool binary, std::vector< T > *v)
Function for reading STL vector of integer types.
Definition: io-funcs-inl.h:232
int32 InputDim() const
Get the dimension of the input,.
#define KALDI_ERR
Definition: kaldi-error.h:147
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:185
#define KALDI_LOG
Definition: kaldi-error.h:153

◆ NumParams()

int32 NumParams ( ) const
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().

167  {
168  int32 ans = 0;
169  for (int32 p = 0; p < weight_.size(); p++) {
170  ans += weight_[p].Dim();
171  }
172  return ans;
173  }
kaldi::int32 int32
std::vector< Vector< BaseFloat > > weight_
Vector of pooling weight vectors,.

◆ PropagateFnc()

void PropagateFnc ( const CuMatrixBase< BaseFloat > &  in,
CuMatrixBase< BaseFloat > *  out 
)
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_.

217  {
218  // check dims
219  KALDI_ASSERT(in.NumCols() % feature_dim_ == 0);
220  KALDI_ASSERT(out->NumCols() % feature_dim_ == 0);
221  // useful dims
222  int32 num_pools = offset_.size();
223  // compute the output pools
224  for (int32 p = 0; p < num_pools; p++) {
225  CuSubMatrix<BaseFloat> tgt(out->ColRange(p*feature_dim_, feature_dim_));
226  tgt.SetZero(); // reset
227  for (int32 i = 0; i < weight_[p].Dim(); i++) {
228  tgt.AddMat(weight_[p](i), in.ColRange((offset_[p]+i) * feature_dim_, feature_dim_));
229  }
230  }
231  }
kaldi::int32 int32
std::vector< Vector< BaseFloat > > weight_
Vector of pooling weight vectors,.
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:185

◆ ReadData()

void ReadData ( std::istream &  is,
bool  binary 
)
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_.

116  {
117  // get the input dimension before splicing
118  ExpectToken(is, binary, "<FeatureDim>");
119  ReadBasicType(is, binary, &feature_dim_);
120  ExpectToken(is, binary, "<LearnRateCoef>");
121  ReadBasicType(is, binary, &learn_rate_coef_);
122  ExpectToken(is, binary, "<Normalize>");
123  ReadBasicType(is, binary, &normalize_);
124  // read the offsets w.r.t. central frame
125  ExpectToken(is, binary, "<FrameOffset>");
126  ReadIntegerVector(is, binary, &offset_);
127  // read the frame-weights
128  ExpectToken(is, binary, "<FrameWeight>");
129  int32 num_pools = offset_.size();
130  weight_.resize(num_pools);
131  for (int32 p = 0; p < num_pools; p++) {
132  weight_[p].Read(is, binary);
133  }
134  //
135  // Sanity checks:
136  //
139  KALDI_ASSERT(output_dim_ / feature_dim_ == num_pools);
140  KALDI_ASSERT(offset_.size() == weight_.size());
141  // check the shifts don't exceed the splicing
142  int32 total_frame = InputDim() / feature_dim_;
143  for (int32 p = 0; p < num_pools; p++) {
144  KALDI_ASSERT(offset_[p] >= 0);
145  KALDI_ASSERT(offset_[p] + (weight_[p].Dim()-1) < total_frame);
146  }
147  //
148  }
int32 input_dim_
Data members,.
void ReadBasicType(std::istream &is, bool binary, T *t)
ReadBasicType is the name of the read function for bool, integer types, and floating-point types...
Definition: io-funcs-inl.h:55
BaseFloat learn_rate_coef_
Scalar applied to learning rate for weight matrices (to be used in ::Update method),.
kaldi::int32 int32
std::vector< Vector< BaseFloat > > weight_
Vector of pooling weight vectors,.
void ReadIntegerVector(std::istream &is, bool binary, std::vector< T > *v)
Function for reading STL vector of integer types.
Definition: io-funcs-inl.h:232
void ExpectToken(std::istream &is, bool binary, const char *token)
ExpectToken tries to read in the given token, and throws an exception on failure. ...
Definition: io-funcs.cc:191
int32 InputDim() const
Get the dimension of the input,.
int32 output_dim_
Dimension of the output of the Component,.
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:185

◆ SetParams()

void SetParams ( const VectorBase< BaseFloat > &  params)
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.

189  {
190  KALDI_ERR << "Unimplemented.";
191  }
#define KALDI_ERR
Definition: kaldi-error.h:147

◆ Update()

void Update ( const CuMatrixBase< BaseFloat > &  input,
const CuMatrixBase< BaseFloat > &  diff 
)
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_.

242  {
243  // useful dims
244  int32 num_pools = offset_.size();
245  // lazy init
246  if (weight_diff_.size() != num_pools) weight_diff_.resize(num_pools);
247  // get the derivatives
248  for (int32 p = 0; p < num_pools; p++) {
249  weight_diff_[p].Resize(weight_[p].Dim(), kSetZero); // reset
250  for (int32 i = 0; i < weight_[p].Dim(); i++) {
251  // multiply matrices element-wise, and sum to get the derivative
252  CuSubMatrix<BaseFloat> in_frame(
253  input.ColRange((offset_[p]+i) * feature_dim_, feature_dim_)
254  );
255  CuSubMatrix<BaseFloat> diff_frame(
256  diff.ColRange(p * feature_dim_, feature_dim_)
257  );
258  CuMatrix<BaseFloat> mul_elems(in_frame);
259  mul_elems.MulElements(diff_frame);
260  weight_diff_[p](i) = mul_elems.Sum();
261  }
262  }
263  // update
264  for (int32 p = 0; p < num_pools; p++) {
266  }
267  // force to be positive, re-normalize the sum
268  if (normalize_) {
269  for (int32 p = 0; p < num_pools; p++) {
270  weight_[p].ApplyFloor(0.0);
271  weight_[p].Scale(1.0/weight_[p].Sum());
272  }
273  }
274  }
NnetTrainOptions opts_
Option-class with training hyper-parameters,.
BaseFloat learn_rate_coef_
Scalar applied to learning rate for weight matrices (to be used in ::Update method),.
kaldi::int32 int32
std::vector< Vector< BaseFloat > > weight_
Vector of pooling weight vectors,.
std::vector< Vector< BaseFloat > > weight_diff_
detivatives of weight vectors,

◆ WriteData()

void WriteData ( std::ostream &  os,
bool  binary 
) const
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().

150  {
151  WriteToken(os, binary, "<FeatureDim>");
152  WriteBasicType(os, binary, feature_dim_);
153  WriteToken(os, binary, "<LearnRateCoef>");
154  WriteBasicType(os, binary, learn_rate_coef_);
155  WriteToken(os, binary, "<Normalize>");
156  WriteBasicType(os, binary, normalize_);
157  WriteToken(os, binary, "<FrameOffset>");
158  WriteIntegerVector(os, binary, offset_);
159  // write pooling weights of individual frames
160  WriteToken(os, binary, "<FrameWeight>");
161  int32 num_pools = offset_.size();
162  for (int32 p = 0; p < num_pools; p++) {
163  weight_[p].Write(os, binary);
164  }
165  }
BaseFloat learn_rate_coef_
Scalar applied to learning rate for weight matrices (to be used in ::Update method),.
kaldi::int32 int32
std::vector< Vector< BaseFloat > > weight_
Vector of pooling weight vectors,.
void WriteToken(std::ostream &os, bool binary, const char *token)
The WriteToken functions are for writing nonempty sequences of non-space characters.
Definition: io-funcs.cc:134
void WriteIntegerVector(std::ostream &os, bool binary, const std::vector< T > &v)
Function for writing STL vectors of integer types.
Definition: io-funcs-inl.h:198
void WriteBasicType(std::ostream &os, bool binary, T t)
WriteBasicType is the name of the write function for bool, integer types, and floating-point types...
Definition: io-funcs-inl.h:34

Member Data Documentation

◆ feature_dim_

◆ normalize_

◆ offset_

◆ weight_

◆ weight_diff_

std::vector<Vector<BaseFloat> > weight_diff_
private

detivatives of weight vectors,

Definition at line 282 of file nnet-frame-pooling-component.h.

Referenced by FramePoolingComponent::InfoGradient(), and FramePoolingComponent::Update().


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