30 features_(input_feats),
32 trans_model_(trans_model),
34 feat_dim_(input_feats->Dim()),
35 left_context_(nnet.GetNnet().LeftContext()),
36 right_context_(nnet.GetNnet().RightContext()),
37 num_pdfs_(nnet.GetNnet().OutputDim()),
42 "Priors in neural network not set up (or mismatch " 43 "with transition model).");
68 if (features_ready == 0)
74 if (input_finished)
return features_ready;
90 int32 input_frame_begin;
94 input_frame_begin = frame;
95 int32 max_possible_input_frame_end = features_ready;
98 int32 input_frame_end = std::min<int32>(max_possible_input_frame_end,
105 for (
int32 t = input_frame_begin; t < input_frame_end; t++) {
107 int32 t_modified = t;
111 if (t_modified >= features_ready)
112 t_modified = features_ready - 1;
116 cu_features.
Swap(&features);
119 int32 num_frames_out = input_frame_end - input_frame_begin -
127 false, &cu_posteriors);
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void ApplyFloor(Real floor_val)
virtual void GetFrame(int32 frame, VectorBase< BaseFloat > *feat)=0
Gets the feature vector for this frame.
Matrix< BaseFloat > scaled_loglikes_
CuVector< BaseFloat > log_priors_
This class represents a matrix that's stored on the GPU if we have one, and in memory if not...
void NnetComputation(const Nnet &nnet, const CuMatrixBase< BaseFloat > &input, bool pad_input, CuMatrixBase< BaseFloat > *output)
Does the basic neural net computation, on a sequence of data (e.g.
virtual int32 NumFramesReady() const
The call NumFramesReady() will return the number of frames currently available for this decodable obj...
int32 TransitionIdToPdf(int32 trans_id) const
void ComputeForFrame(int32 frame)
If the neural-network outputs for this frame are not cached, it computes them (and possibly for some ...
DecodableNnet2OnlineOptions opts_
void AddVecToRows(Real alpha, const CuVectorBase< Real > &row, Real beta=1.0)
(for each row r of *this), r = alpha * row + beta * r
void Swap(Matrix< Real > *mat)
const VectorBase< BaseFloat > & Priors() const
virtual bool IsLastFrame(int32 frame) const =0
Returns true if this is the last frame.
virtual bool IsLastFrame(int32 frame) const
Returns true if this is the last frame.
virtual BaseFloat LogLikelihood(int32 frame, int32 index)
Returns the scaled log likelihood.
#define KALDI_ASSERT(cond)
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix).
DecodableNnet2Online(const AmNnet &nnet, const TransitionModel &trans_model, const DecodableNnet2OnlineOptions &opts, OnlineFeatureInterface *input_feats)
void Resize(const MatrixIndexT r, const MatrixIndexT c, MatrixResizeType resize_type=kSetZero, MatrixStrideType stride_type=kDefaultStride)
Sets matrix to a specified size (zero is OK as long as both r and c are zero).
OnlineFeatureInterface is an interface for online feature processing (it is also usable in the offlin...
OnlineFeatureInterface * features_
const TransitionModel & trans_model_
int32 max_nnet_batch_size
virtual int32 NumFramesReady() const =0
returns the feature dimension.
Represents a non-allocating general vector which can be defined as a sub-vector of higher-level vecto...
const Nnet & GetNnet() const