22 #ifndef KALDI_NNET_NNET_PARAMETRIC_RELU_H_    23 #define KALDI_NNET_NNET_PARAMETRIC_RELU_H_    58     while (is >> std::ws, !is.eof()) {
    64       else KALDI_ERR << 
"Unknown token " << token << 
", a typo in config?"    65                   << 
" (Alpha|Beta|AlphaLearnRateCoef|BetaLearnRateCoef)";
    75     while (
'<' == 
Peek(is, binary)) {
    78         case 'A': 
ExpectToken(is, binary, 
"<AlphaLearnRateCoef>");
    81         case 'B': 
ExpectToken(is, binary, 
"<BetaLearnRateCoef>");
    92     beta_.Read(is, binary);
    97   void WriteData(std::ostream &os, 
bool binary)
 const {
    98     WriteToken(os, binary, 
"<AlphaLearnRateCoef>");
   100     WriteToken(os, binary, 
"<BetaLearnRateCoef>");
   104     if (!binary) os << 
"\n";
   106     beta_.Write(os, binary);
   133     alpha_.CopyFromVec(params.
Range(0, alpha_num_elem));
   134     beta_.CopyFromVec(params.
Range(alpha_num_elem, beta_num_elem));
   138     return std::string(
"\n  alpha") +
   145     return std::string(
"\n  alpha_grad") +
   213 #endif  // KALDI_NNET_NNET_PARAMETRIC_RELU_H_ std::string ToString(const T &t)
Convert basic type to a string (please don't overuse),. 
 
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
void InitData(std::istream &is)
Initialize the content of the component by the 'line' from the prototype,. 
 
void ReadData(std::istream &is, bool binary)
Reads the component content. 
 
void PropagateFnc(const CuMatrixBase< BaseFloat > &in, CuMatrixBase< BaseFloat > *out)
Abstract interface for propagation/backpropagation. 
 
BaseFloat beta_learn_rate_coef_
Controls learning rate for beta (0.0 disables learning),. 
 
int32 NumParams() const
Number of trainable parameters,. 
 
NnetTrainOptions opts_
Option-class with training hyper-parameters,. 
 
std::string MomentStatistics(const VectorBase< Real > &vec)
Get a string with statistics of the data in a vector, so we can print them easily. 
 
void WriteData(std::ostream &os, bool binary) const
Writes the component content. 
 
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...
 
void GetGradient(VectorBase< BaseFloat > *gradient) const
Get gradient reshaped as a vector,. 
 
Class UpdatableComponent is a Component which has trainable parameters, it contains SGD training hype...
 
void ReadToken(std::istream &is, bool binary, std::string *str)
ReadToken gets the next token and puts it in str (exception on failure). 
 
CuMatrix< BaseFloat > alpha_aux_
Auxiliary matrix for getting 'alpha' updates,. 
 
This class represents a matrix that's stored on the GPU if we have one, and in memory if not...
 
Component * Copy() const
Copy component (deep copy),. 
 
CuVector< BaseFloat > alpha_
Vector of 'alphas', one value per neuron. 
 
int Peek(std::istream &is, bool binary)
Peek consumes whitespace (if binary == false) and then returns the peek() value of the stream...
 
ComponentType
Component type identification mechanism,. 
 
void SetParams(const VectorBase< BaseFloat > ¶ms)
Set the trainable parameters from, reshaped as a vector,. 
 
std::string Info() const
Print some additional info (after <ComponentName> and the dims),. 
 
void ExpectToken(std::istream &is, bool binary, const char *token)
ExpectToken tries to read in the given token, and throws an exception on failure. ...
 
void WriteToken(std::ostream &os, bool binary, const char *token)
The WriteToken functions are for writing nonempty sequences of non-space characters. 
 
MatrixIndexT Dim() const
Returns the dimension of the vector. 
 
int PeekToken(std::istream &is, bool binary)
PeekToken will return the first character of the next token, or -1 if end of file. 
 
CuVector< BaseFloat > beta_
Vector of 'betas', one value per neuron. 
 
ParametricRelu(int32 dim_in, int32 dim_out)
 
ComponentType GetType() const
Get Type Identification of the component,. 
 
int32 output_dim_
Dimension of the output of the Component,. 
 
Matrix for CUDA computing. 
 
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...) 
 
A class representing a vector. 
 
#define KALDI_ASSERT(cond)
 
CuVector< BaseFloat > beta_corr_
Vector of 'beta' updates. 
 
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...
 
Abstract class, building block of the network. 
 
CuMatrix< BaseFloat > beta_aux_
Auxiliary matrix for getting 'beta' updates,. 
 
void Update(const CuMatrixBase< BaseFloat > &input, const CuMatrixBase< BaseFloat > &diff)
Compute gradient and update parameters,. 
 
Provides a vector abstraction class. 
 
void ParametricRelu(const CuMatrixBase< Real > &src, const CuVectorBase< Real > &alpha, const CuVectorBase< Real > &beta)
Compute the parametric rectified linear unit function; element by element, *this = src * (src > 0 ...
 
void DiffParametricRelu(const CuMatrixBase< Real > &value, const CuMatrixBase< Real > &diff, const CuVectorBase< Real > &alpha, const CuVectorBase< Real > &beta)
Differentiate backward through the parametric relu function. 
 
std::string InfoGradient() const
Print some additional info about gradient (after <...> and dims),. 
 
CuVector< BaseFloat > alpha_corr_
Vector of 'alpha' updates. 
 
BaseFloat alpha_learn_rate_coef_
Controls learning rate for alpha (0.0 disables learning),. 
 
void GetParams(VectorBase< BaseFloat > *params) const
Get the trainable parameters reshaped as a vector,. 
 
SubVector< Real > Range(const MatrixIndexT o, const MatrixIndexT l)
Returns a sub-vector of a vector (a range of elements).