37 if (ac == NULL || nc == NULL)
continue;
46 if (sc != NULL) max_deriv = 0.25;
47 else if (tc != NULL) max_deriv = 1.0;
48 else if (rc != NULL) { max_deriv = 1.0; is_relu =
true; }
53 if (count == 0.0 || deriv_sum.Dim() == 0) {
54 KALDI_WARN <<
"Cannot fix neural net because no statistics are stored.";
59 int32 dim = nc->
InputDim(), num_small_deriv = 0, num_large_deriv = 0;
63 BaseFloat deriv_ratio = deriv_sum(
d) / (count * max_deriv);
77 bias_params(
d) *= 1.0 / parameter_factor;
78 linear_params.Row(
d).Scale(1.0 / parameter_factor);
90 bias_params(
d) *= parameter_factor;
91 linear_params.Row(
d).Scale(parameter_factor);
97 KALDI_LOG <<
"For layer " << c <<
" (ReLU units), increased bias for " 98 << num_small_deriv <<
" indexes and decreased it for " 99 << num_large_deriv <<
", out of a total of " << dim;
101 KALDI_LOG <<
"For layer " << c <<
", decreased parameters for " 102 << num_small_deriv <<
" indexes, and increased them for " 103 << num_large_deriv <<
" out of a total of " << dim;
105 ac->
SetParams(bias_params, linear_params);
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
const Component & GetComponent(int32 c) const
virtual void SetParams(const VectorBase< BaseFloat > &bias, const MatrixBase< BaseFloat > &linear)
This kind of Component is a base-class for things like sigmoid and softmax.
const CuVector< BaseFloat > & BiasParams()
void FixNnet(const NnetFixConfig &config, Nnet *nnet)
virtual int32 InputDim() const
Get size of input vectors.
BaseFloat min_average_deriv
int32 NumComponents() const
Returns number of components– think of this as similar to # of layers, but e.g.
BaseFloat relu_bias_change
BaseFloat max_average_deriv
BaseFloat parameter_factor
#define KALDI_ASSERT(cond)
const CuVector< double > & DerivSum() const
const CuMatrix< BaseFloat > & LinearParams()