All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RandomizerMask Class Reference

Generates randomly ordered vector of indices,. More...

#include <nnet-randomizer.h>

Collaboration diagram for RandomizerMask:

Public Member Functions

 RandomizerMask ()
 
 RandomizerMask (const NnetDataRandomizerOptions &conf)
 
void Init (const NnetDataRandomizerOptions &conf)
 Init, call srand,. More...
 
const std::vector< int32 > & Generate (int32 mask_size)
 Generate randomly ordered vector of integers 0..[mask_size -1],. More...
 

Private Attributes

std::vector< int32 > mask_
 

Detailed Description

Generates randomly ordered vector of indices,.

Definition at line 64 of file nnet-randomizer.h.

Constructor & Destructor Documentation

RandomizerMask ( )
inline

Definition at line 66 of file nnet-randomizer.h.

67  { }
RandomizerMask ( const NnetDataRandomizerOptions conf)
inlineexplicit

Definition at line 69 of file nnet-randomizer.h.

References RandomizerMask::Init().

69  {
70  Init(conf);
71  }
void Init(const NnetDataRandomizerOptions &conf)
Init, call srand,.

Member Function Documentation

const std::vector< int32 > & Generate ( int32  mask_size)

Generate randomly ordered vector of integers 0..[mask_size -1],.

Definition at line 36 of file nnet-randomizer.cc.

References rnnlm::i, and RandomizerMask::mask_.

Referenced by main(), and UnitTestRandomizerMask().

36  {
37  mask_.resize(mask_size);
38  for (int32 i = 0; i < mask_size; i++) mask_[i] = i;
39  // shuffle using built-in random generator:
40  std::random_shuffle(mask_.begin(), mask_.end());
41  return mask_;
42 }
std::vector< int32 > mask_
void Init ( const NnetDataRandomizerOptions conf)

Init, call srand,.

Definition at line 31 of file nnet-randomizer.cc.

References KALDI_LOG, and NnetDataRandomizerOptions::randomizer_seed.

Referenced by RandomizerMask::RandomizerMask(), and UnitTestRandomizerMask().

31  {
32  KALDI_LOG << "Seeding by srand with : " << conf.randomizer_seed;
33  srand(conf.randomizer_seed);
34 }
#define KALDI_LOG
Definition: kaldi-error.h:133

Member Data Documentation

std::vector<int32> mask_
private

Definition at line 80 of file nnet-randomizer.h.

Referenced by RandomizerMask::Generate().


The documentation for this class was generated from the following files: