21 #ifndef KALDI_NNET_NNET_RANDOMIZER_H_ 22 #define KALDI_NNET_NNET_RANDOMIZER_H_ 44 randomizer_size(32768),
50 opts->
Register(
"randomizer-size", &randomizer_size,
51 "Capacity of randomizer, length of concatenated utterances which, " 52 "are used for frame-level shuffling (in frames, affects memory " 53 "consumption, max 8000000).");
54 opts->
Register(
"randomizer-seed", &randomizer_seed,
55 "Seed value for srand, sets fixed order of frame-level shuffling");
56 opts->
Register(
"minibatch-size", &minibatch_size,
"Size of a minibatch.");
77 const std::vector<int32>& Generate(
int32 mask_size);
111 return ((data_begin_ == 0) && (data_end_ > conf_.randomizer_size ));
120 void Randomize(
const std::vector<int32>& mask);
124 return (data_end_ - data_begin_ < conf_.minibatch_size);
172 return ((data_begin_ == 0) && (data_end_ > conf_.randomizer_size ));
181 void Randomize(
const std::vector<int32>& mask);
185 return (data_end_ - data_begin_ < conf_.minibatch_size);
229 void AddData(
const std::vector<T>& v);
233 return ((data_begin_ == 0) && (data_end_ > conf_.randomizer_size ));
242 void Randomize(
const std::vector<int32>& mask);
246 return (data_end_ - data_begin_ < conf_.minibatch_size);
253 const std::vector<T>& Value();
274 #endif // KALDI_NNET_NNET_RANDOMIZER_H_ StdVectorRandomizer< std::vector< std::pair< int32, BaseFloat > > > PosteriorRandomizer
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
int32 data_begin_
A cursor, pointing to the 'row' where the next mini-batch begins,.
int32 data_end_
A cursor, pointing to the 'row' after the end of data,.
bool IsFull()
Returns true, when capacity is full.
NnetDataRandomizerOptions conf_
MatrixRandomizer(const NnetDataRandomizerOptions &conf)
bool Done()
Returns true, if no more data for another mini-batch (after current one)
NnetDataRandomizerOptions conf_
int32 data_end_
A cursor, pointing to the 'row' after the end of data,.
void Randomize(const CuMatrixBase< Real > &src, const CuArray< int32 > ©_from_idx, CuMatrixBase< Real > *tgt)
Copies a permutation of src into tgt.
Generates randomly ordered vector of indices,.
int32 data_begin_
A cursor, pointing to the 'row' where the next mini-batch begins,.
std::vector< T > minibatch_
bool Done()
Returns true, if no more data for another mini-batch (after current one)
Randomizes elements of a vector according to a mask.
This class represents a matrix that's stored on the GPU if we have one, and in memory if not...
int32 data_begin_
A cursor, pointing to the 'row' where the next mini-batch begins,.
void Init(const NnetDataRandomizerOptions &conf)
Set the randomizer parameters (size)
StdVectorRandomizer(const NnetDataRandomizerOptions &conf)
VectorRandomizer(const NnetDataRandomizerOptions &conf)
bool Done()
Returns true, if no more data for another mini-batch (after current one)
int32 randomizer_size
Maximum number of samples we have in memory,.
virtual void Register(const std::string &name, bool *ptr, const std::string &doc)=0
int32 NumFrames()
Number of frames stored inside the Randomizer.
int32 NumFrames()
Number of frames stored inside the Randomizer.
std::vector< int32 > mask_
CuMatrix< BaseFloat > data_
Configuration variables that affect how frame-level shuffling is done.
RandomizerMask(const NnetDataRandomizerOptions &conf)
Vector< BaseFloat > minibatch_
void Init(const NnetDataRandomizerOptions &conf)
Set the randomizer parameters (size)
StdVectorRandomizer< int32 > Int32VectorRandomizer
int32 NumFrames()
Number of frames stored inside the Randomizer.
int32 data_end_
A cursor, pointing to the 'row' after the end of data,.
NnetDataRandomizerOptions conf_
Vector< BaseFloat > data_
Shuffles rows of a matrix according to the indices in the mask,.
Matrix for CUDA computing.
A class representing a vector.
bool IsFull()
Returns true, when capacity is full.
void Register(OptionsItf *opts)
CuMatrix< BaseFloat > data_aux_
void Init(const NnetDataRandomizerOptions &conf)
Set the randomizer parameters (size)
Randomizes elements of a vector according to a mask.
NnetDataRandomizerOptions()
bool IsFull()
Returns true, when capacity is full.
CuMatrix< BaseFloat > minibatch_