This struct stores neural net training examples to be used in multi-threaded training. More...
Public Member Functions | |
void | AcceptExample (const DiscriminativeNnetExample &example) |
The following function is called by the code that reads in the examples. More... | |
void | ExamplesDone () |
The following function is called by the code that reads in the examples, when we're done reading examples; it signals this way to this class that the stream is now empty. More... | |
DiscriminativeNnetExample * | ProvideExample () |
This function is called by the code that does the training. More... | |
DiscriminativeExamplesRepository () | |
Private Member Functions | |
KALDI_DISALLOW_COPY_AND_ASSIGN (DiscriminativeExamplesRepository) | |
Private Attributes | |
int32 | buffer_size_ |
Semaphore | full_semaphore_ |
Semaphore | empty_semaphore_ |
std::mutex | examples_mutex_ |
std::deque< DiscriminativeNnetExample * > | examples_ |
bool | done_ |
This struct stores neural net training examples to be used in multi-threaded training.
Definition at line 33 of file nnet-compute-discriminative-parallel.cc.
|
inline |
Definition at line 49 of file nnet-compute-discriminative-parallel.cc.
void AcceptExample | ( | const DiscriminativeNnetExample & | example | ) |
The following function is called by the code that reads in the examples.
Definition at line 64 of file nnet-compute-discriminative-parallel.cc.
References DiscriminativeExamplesRepository::empty_semaphore_, DiscriminativeExamplesRepository::examples_, DiscriminativeExamplesRepository::examples_mutex_, DiscriminativeExamplesRepository::full_semaphore_, Semaphore::Signal(), and Semaphore::Wait().
Referenced by kaldi::nnet2::NnetDiscriminativeUpdateParallel().
void ExamplesDone | ( | ) |
The following function is called by the code that reads in the examples, when we're done reading examples; it signals this way to this class that the stream is now empty.
Definition at line 73 of file nnet-compute-discriminative-parallel.cc.
References DiscriminativeExamplesRepository::buffer_size_, DiscriminativeExamplesRepository::done_, DiscriminativeExamplesRepository::empty_semaphore_, DiscriminativeExamplesRepository::examples_, DiscriminativeExamplesRepository::examples_mutex_, DiscriminativeExamplesRepository::full_semaphore_, rnnlm::i, KALDI_ASSERT, Semaphore::Signal(), and Semaphore::Wait().
Referenced by kaldi::nnet2::NnetDiscriminativeUpdateParallel().
|
private |
DiscriminativeNnetExample * ProvideExample | ( | ) |
This function is called by the code that does the training.
If there is an example available it will provide it, or it will sleep till one is available. It returns NULL when there are no examples left and ExamplesDone() has been called.
Definition at line 84 of file nnet-compute-discriminative-parallel.cc.
References DiscriminativeExamplesRepository::done_, DiscriminativeExamplesRepository::empty_semaphore_, DiscriminativeExamplesRepository::examples_, DiscriminativeExamplesRepository::examples_mutex_, DiscriminativeExamplesRepository::full_semaphore_, KALDI_ASSERT, Semaphore::Signal(), and Semaphore::Wait().
|
private |
Definition at line 53 of file nnet-compute-discriminative-parallel.cc.
Referenced by DiscriminativeExamplesRepository::ExamplesDone().
|
private |
Definition at line 59 of file nnet-compute-discriminative-parallel.cc.
Referenced by DiscriminativeExamplesRepository::ExamplesDone(), and DiscriminativeExamplesRepository::ProvideExample().
|
private |
Definition at line 55 of file nnet-compute-discriminative-parallel.cc.
Referenced by DiscriminativeExamplesRepository::AcceptExample(), DiscriminativeExamplesRepository::ExamplesDone(), and DiscriminativeExamplesRepository::ProvideExample().
|
private |
Definition at line 58 of file nnet-compute-discriminative-parallel.cc.
Referenced by DiscriminativeExamplesRepository::AcceptExample(), DiscriminativeExamplesRepository::ExamplesDone(), and DiscriminativeExamplesRepository::ProvideExample().
|
private |
Definition at line 56 of file nnet-compute-discriminative-parallel.cc.
Referenced by DiscriminativeExamplesRepository::AcceptExample(), DiscriminativeExamplesRepository::ExamplesDone(), and DiscriminativeExamplesRepository::ProvideExample().
|
private |
Definition at line 54 of file nnet-compute-discriminative-parallel.cc.
Referenced by DiscriminativeExamplesRepository::AcceptExample(), DiscriminativeExamplesRepository::ExamplesDone(), and DiscriminativeExamplesRepository::ProvideExample().