20 #ifndef KALDI_NNET_NNET_NNET_H_ 21 #define KALDI_NNET_NNET_NNET_H_ 129 void ResetStreams(
const std::vector<int32> &stream_reset_flag);
132 void SetSeqLengths(
const std::vector<int32> &sequence_lengths);
135 void Init(
const std::string &proto_file);
138 void Read(
const std::string &rxfilename);
140 void Read(std::istream &in,
bool binary);
143 void Write(
const std::string &wxfilename,
bool binary)
const;
145 void Write(std::ostream &out,
bool binary)
const;
148 std::string
Info()
const;
184 #endif // KALDI_NNET_NNET_NNET_H_ void Backpropagate(const CuMatrixBase< BaseFloat > &out_diff, CuMatrix< BaseFloat > *in_diff)
Perform backward pass through the network,.
void RemoveLastComponent()
Remove the last of the Components,.
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void ResetStreams(const std::vector< int32 > &stream_reset_flag)
Reset streams in multi-stream training,.
void SetParams(const VectorBase< BaseFloat > ¶ms)
Set the network weights from a supervector,.
void AppendComponentPointer(Component *dynamically_allocated_comp)
Append Component* to 'this' instance of Nnet by a shallow copy ('this' instance of Nnet over-takes th...
void ReplaceComponent(int32 c, const Component &comp)
Replace c'th component in 'this' Nnet (deep copy),.
void Propagate(const CuMatrixBase< BaseFloat > &in, CuMatrix< BaseFloat > *out)
Perform forward pass through the network,.
void GetParams(Vector< BaseFloat > *params) const
Get the network weights in a supervector,.
int32 NumParams() const
Get the number of parameters in the network,.
const std::vector< CuMatrix< BaseFloat > > & PropagateBuffer() const
Access to the forward-pass buffers.
void SetSeqLengths(const std::vector< int32 > &sequence_lengths)
Set sequence length in LSTM multi-stream training,.
int32 NumComponents() const
Returns the number of 'Components' which form the NN.
const std::vector< CuMatrix< BaseFloat > > & BackpropagateBuffer() const
Access to the backward-pass buffers.
void Write(const std::string &wxfilename, bool binary) const
Write Nnet to 'wxfilename',.
int32 InputDim() const
Dimensionality on network input (input feature dim.),.
const NnetTrainOptions & GetTrainOptions() const
Get training hyper-parameters from the network,.
This class represents a matrix that's stored on the GPU if we have one, and in memory if not...
const Component & GetLastComponent() const
LastComponent accessor,.
void GetGradient(Vector< BaseFloat > *gradient) const
Get the gradient stored in the network,.
int32 OutputDim() const
Dimensionality of network outputs (posteriors | bn-features | etc.),.
void SwapComponent(int32 c, Component **comp)
Swap c'th component with the pointer,.
std::string InfoBackPropagate(bool header=true) const
Create string with back-propagation-buffer statistics,.
void AppendNnet(const Nnet &nnet_to_append)
Append other Nnet to the 'this' Nnet (copy all its components),.
void Read(const std::string &rxfilename)
Read Nnet from 'rxfilename',.
void Check() const
Consistency check,.
void Destroy()
Relese the memory,.
std::vector< CuMatrix< BaseFloat > > propagate_buf_
Buffers for forward pass (on demand initialization),.
void Feedforward(const CuMatrixBase< BaseFloat > &in, CuMatrix< BaseFloat > *out)
Perform forward pass through the network (with 2 swapping buffers),.
std::vector< Component * > components_
Vector which contains all the components composing the neural network, the components are for example...
Matrix for CUDA computing.
void Init(const std::string &proto_file)
Initialize the Nnet from the prototype,.
A class representing a vector.
void SetDropoutRate(BaseFloat r)
Set the dropout rate.
std::string InfoGradient(bool header=true) const
Create string with per-component gradient statistics,.
std::string InfoPropagate(bool header=true) const
Create string with propagation-buffer statistics,.
std::string Info() const
Create string with human readable description of the nnet,.
void RemoveComponent(int32 c)
Remove c'th component,.
const Component & GetComponent(int32 c) const
Component accessor,.
void SetTrainOptions(const NnetTrainOptions &opts)
Set hyper-parameters of the training (pushes to all UpdatableComponents),.
Abstract class, building block of the network.
NnetTrainOptions opts_
Option class with hyper-parameters passed to UpdatableComponent(s)
std::vector< CuMatrix< BaseFloat > > backpropagate_buf_
Buffers for backward pass (on demand initialization),.
Provides a vector abstraction class.
void AppendComponent(const Component &comp)
Append Component to 'this' instance of Nnet (deep copy),.
Nnet & operator=(const Nnet &other)