31 std::vector<NonlinearComponent*> c2,
37 if (new_dim <= old_dim) {
38 KALDI_WARN <<
"Not widening component because new dim " 39 << new_dim <<
" <= old dim " << old_dim;
46 this->
bias_params_.Range(old_dim, extra_dim).Scale(bias_stddev);
54 for (
size_t i = 0;
i < c2.size();
i++)
55 c2[
i]->SetDim(new_dim);
66 int32 num_widened = 0;
68 for (
int32 c = 0; c < C - 3; c++) {
70 if (c1 == NULL)
continue;
71 std::vector<NonlinearComponent*> c2;
72 c2.push_back(dynamic_cast<NonlinearComponent*>(&(nnet->
GetComponent(c+1))));
73 if (c2.back() == NULL)
continue;
74 c2.push_back(dynamic_cast<NonlinearComponent*>(&(nnet->
GetComponent(c+2))));
76 if (c2.back() == NULL) {
80 if (c + 3 >= C)
continue;
83 if (c3 == NULL)
continue;
86 KALDI_LOG <<
"Widening component " << c <<
" from " 95 KALDI_LOG <<
"Widened " << num_widened <<
" components.";
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
const Component & GetComponent(int32 c) const
CuVector< BaseFloat > bias_params_
BaseFloat param_stddev_factor
int32 NumComponents() const
Returns number of components– think of this as similar to # of layers, but e.g.
void Widen(int32 new_dimension, BaseFloat param_stddev, BaseFloat bias_stddev, std::vector< NonlinearComponent *> c2, AffineComponent *c3)
This function is implemented in widen-nnet.cc.
virtual int32 InputDim() const
Get size of input vectors.
virtual int32 OutputDim() const
Get size of output vectors.
Configuration class that controls neural net "widening", which means increasing the dimension of the ...
#define KALDI_ASSERT(cond)
CuMatrix< BaseFloat > linear_params_
void WidenNnet(const NnetWidenConfig &widen_config, Nnet *nnet)
This function widens a neural network by increasing the hidden-layer dimensions to the target...