A buffer for caching (utterance-key, feature-matrix) pairs. More...
#include <nnet-matrix-buffer.h>
Public Member Functions | |
MatrixBuffer () | |
~MatrixBuffer () | |
void | Init (SequentialBaseFloatMatrixReader *reader, MatrixBufferOptions opts=MatrixBufferOptions()) |
bool | Done () |
void | Next () |
void | ResetLength () |
std::string | Key () |
Matrix< BaseFloat > | Value () |
size_t | SizeInBytes () const |
Total amount of features in the buffer (bytes),. More... | |
size_t | SizeInMegaBytes () const |
Total amount of features in the buffer (Mega-bytes),. More... | |
size_t | NumPairs () const |
Total number of (key,matrix) pairs in the buffer,. More... | |
Private Types | |
typedef std::pair< std::string, Matrix< BaseFloat > > | PairType |
typedef std::list< PairType > | ListType |
typedef std::map< size_t, ListType > | BufferType |
Private Member Functions | |
void | Read () |
fills the buffer, More... | |
void | DisposeValue () |
removes 'current_' from data structure, More... | |
Private Attributes | |
SequentialBaseFloatMatrixReader * | reader_ |
BufferType | buffer_ |
Buffer indexed by 'NumRows()',. More... | |
PairType * | current_ |
The currently active (key,value) pair,. More... | |
MatrixBufferOptions | opts_ |
size_t | preferred_length_ |
A buffer for caching (utterance-key, feature-matrix) pairs.
Typically, it reads 'matrix_buffer_size' megabytes of data, and returns records with similar number of speech frames through the standard Key(), Value(), Next(), Done() interface.
The preferred length is reset by ResetLength(). The buffer gets refilled after having less data than 50% of 'matrix_buffer_size'.
Definition at line 61 of file nnet-matrix-buffer.h.
|
private |
Definition at line 116 of file nnet-matrix-buffer.h.
Definition at line 115 of file nnet-matrix-buffer.h.
Definition at line 114 of file nnet-matrix-buffer.h.
|
inline |
Definition at line 63 of file nnet-matrix-buffer.h.
|
inline |
Definition at line 69 of file nnet-matrix-buffer.h.
|
private |
removes 'current_' from data structure,
Definition at line 215 of file nnet-matrix-buffer.h.
References KALDI_ASSERT.
|
inline |
Definition at line 81 of file nnet-matrix-buffer.h.
|
inline |
Definition at line 72 of file nnet-matrix-buffer.h.
References KALDI_ASSERT.
Referenced by main().
|
inline |
Definition at line 91 of file nnet-matrix-buffer.h.
void Next | ( | ) |
Definition at line 126 of file nnet-matrix-buffer.h.
References rnnlm::i, and KALDI_ASSERT.
size_t NumPairs | ( | ) | const |
Total number of (key,matrix) pairs in the buffer,.
Definition at line 181 of file nnet-matrix-buffer.h.
|
private |
fills the buffer,
Definition at line 189 of file nnet-matrix-buffer.h.
References KALDI_LOG, and MatrixBase< Real >::NumRows().
|
inline |
Definition at line 87 of file nnet-matrix-buffer.h.
size_t SizeInBytes | ( | ) | const |
Total amount of features in the buffer (bytes),.
Definition at line 167 of file nnet-matrix-buffer.h.
size_t SizeInMegaBytes | ( | ) | const |
Total amount of features in the buffer (Mega-bytes),.
Definition at line 177 of file nnet-matrix-buffer.h.
Definition at line 94 of file nnet-matrix-buffer.h.
|
private |
Buffer indexed by 'NumRows()',.
Definition at line 117 of file nnet-matrix-buffer.h.
|
private |
The currently active (key,value) pair,.
Definition at line 119 of file nnet-matrix-buffer.h.
|
private |
Definition at line 121 of file nnet-matrix-buffer.h.
|
private |
Definition at line 123 of file nnet-matrix-buffer.h.
|
private |
Definition at line 112 of file nnet-matrix-buffer.h.