#include <nnet-example.h>
Public Member Functions | |
NnetIo (const std::string &name, int32 t_begin, const MatrixBase< BaseFloat > &feats, int32 t_stride=1) | |
This constructor creates NnetIo with name "name", indexes with n=0, x=0, and t values ranging from t_begin to (t_begin + t_stride * feats.NumRows() - 1) with a stride t_stride, and the provided features. More... | |
NnetIo (const std::string &name, int32 t_begin, const GeneralMatrix &feats, int32 t_stride=1) | |
This constructor creates NnetIo with name "name", indexes with n=0, x=0, and t values ranging from t_begin to (t_begin + t_stride * feats.NumRows() - 1) with a stride t_stride, and the provided features. More... | |
NnetIo (const std::string &name, int32 dim, int32 t_begin, const Posterior &labels, int32 t_stride=1) | |
This constructor sets "name" to the provided string, sets "indexes" with n=0, x=0, and t from t_begin to (t_begin + t_stride * labels.size() - 1) with a stride t_stride, and the labels as provided. More... | |
void | Swap (NnetIo *other) |
NnetIo () | |
void | Write (std::ostream &os, bool binary) const |
void | Read (std::istream &is, bool binary) |
bool | operator== (const NnetIo &other) const |
Public Attributes | |
std::string | name |
the name of the input in the neural net; in simple setups it will just be "input". More... | |
std::vector< Index > | indexes |
"indexes" is a vector the same length as features.NumRows(), explaining the meaning of each row of the "features" matrix. More... | |
GeneralMatrix | features |
The features or labels. More... | |
Definition at line 33 of file nnet-example.h.
NnetIo | ( | const std::string & | name, |
int32 | t_begin, | ||
const MatrixBase< BaseFloat > & | feats, | ||
int32 | t_stride = 1 |
||
) |
This constructor creates NnetIo with name "name", indexes with n=0, x=0, and t values ranging from t_begin to (t_begin + t_stride * feats.NumRows() - 1) with a stride t_stride, and the provided features.
t_begin should be the frame that feats.Row(0) represents.
Definition at line 58 of file nnet-example.cc.
References rnnlm::i, NnetIo::indexes, KALDI_ASSERT, and MatrixBase< Real >::NumRows().
NnetIo | ( | const std::string & | name, |
int32 | t_begin, | ||
const GeneralMatrix & | feats, | ||
int32 | t_stride = 1 |
||
) |
This constructor creates NnetIo with name "name", indexes with n=0, x=0, and t values ranging from t_begin to (t_begin + t_stride * feats.NumRows() - 1) with a stride t_stride, and the provided features.
t_begin should be the frame that the first row of 'feats' represents.
Definition at line 69 of file nnet-example.cc.
References rnnlm::i, NnetIo::indexes, KALDI_ASSERT, and GeneralMatrix::NumRows().
NnetIo | ( | const std::string & | name, |
int32 | dim, | ||
int32 | t_begin, | ||
const Posterior & | labels, | ||
int32 | t_stride = 1 |
||
) |
This constructor sets "name" to the provided string, sets "indexes" with n=0, x=0, and t from t_begin to (t_begin + t_stride * labels.size() - 1) with a stride t_stride, and the labels as provided.
t_begin should be the frame to which labels[0] corresponds.
Definition at line 86 of file nnet-example.cc.
References NnetIo::features, rnnlm::i, NnetIo::indexes, and KALDI_ASSERT.
|
inline |
Definition at line 78 of file nnet-example.h.
References NnetIo::operator==(), NnetIo::Read(), and NnetIo::Write().
Definition at line 46 of file nnet-example.cc.
References kaldi::ApproxEqual(), NnetIo::features, GeneralMatrix::GetMatrix(), NnetIo::indexes, NnetIo::name, GeneralMatrix::NumCols(), and GeneralMatrix::NumRows().
Referenced by NnetIo::NnetIo().
void Read | ( | std::istream & | is, |
bool | binary | ||
) |
Definition at line 38 of file nnet-example.cc.
References kaldi::nnet3::ExpectToken(), NnetIo::features, NnetIo::indexes, NnetIo::name, GeneralMatrix::Read(), kaldi::nnet3::ReadIndexVector(), and kaldi::ReadToken().
Referenced by NnetIo::NnetIo(), and NnetExample::Read().
void Swap | ( | NnetIo * | other | ) |
Definition at line 80 of file nnet-example.cc.
References NnetIo::features, NnetIo::indexes, NnetIo::name, and GeneralMatrix::Swap().
void Write | ( | std::ostream & | os, |
bool | binary | ||
) | const |
Definition at line 28 of file nnet-example.cc.
References NnetIo::features, NnetIo::indexes, KALDI_ASSERT, NnetIo::name, GeneralMatrix::NumRows(), GeneralMatrix::Write(), kaldi::nnet3::WriteIndexVector(), and kaldi::WriteToken().
Referenced by NnetIo::NnetIo(), and NnetExample::Write().
GeneralMatrix features |
The features or labels.
GeneralMatrix may contain either a CompressedMatrix, a Matrix, or SparseMatrix (a SparseMatrix would be the natural format for posteriors).
Definition at line 46 of file nnet-example.h.
Referenced by NnetComputer::AcceptInputs(), NnetLdaStatsAccumulator::AccStatsFromOutput(), kaldi::nnet3::ExampleApproxEqual(), kaldi::nnet3::FilterExample(), kaldi::nnet3::GenerateSimpleNnetTrainingExample(), kaldi::nnet3::GetIoSizes(), kaldi::nnet3::MergeIo(), NnetIo::NnetIo(), NnetIoStructureCompare::operator()(), NnetIo::operator==(), kaldi::nnet3::PerturbImageInNnetExample(), NnetComputeProb::ProcessOutputs(), NnetTrainer::ProcessOutputs(), NnetIo::Read(), NnetIo::Swap(), and NnetIo::Write().
std::vector<Index> indexes |
"indexes" is a vector the same length as features.NumRows(), explaining the meaning of each row of the "features" matrix.
Note: the "n" values in the indexes will always be zero in individual examples, but in general nonzero after we aggregate the examples into the minibatch level.
Definition at line 42 of file nnet-example.h.
Referenced by kaldi::nnet3::ContainsSingleExample(), kaldi::nnet3::ExampleApproxEqual(), kaldi::nnet3::FilterExample(), kaldi::nnet3::GetChainComputationRequest(), kaldi::nnet3::GetComputationRequest(), kaldi::nnet3::GetDiscriminativeComputationRequest(), kaldi::nnet3::GetIoSizes(), kaldi::nnet3::GetNumNvalues(), main(), kaldi::nnet3::MergeIo(), NnetIo::NnetIo(), NnetIoStructureCompare::operator()(), NnetIo::operator==(), NnetIo::Read(), NnetIo::Swap(), NnetIo::Write(), and kaldi::nnet3::WriteExamples().
std::string name |
the name of the input in the neural net; in simple setups it will just be "input".
Definition at line 36 of file nnet-example.h.
Referenced by NnetComputer::AcceptInputs(), kaldi::nnet3::ContainsSingleExample(), kaldi::nnet3::ExampleApproxEqual(), kaldi::nnet3::FilterExample(), kaldi::nnet3::GetChainComputationRequest(), kaldi::nnet3::GetComputationRequest(), kaldi::nnet3::GetDiscriminativeComputationRequest(), kaldi::nnet3::GetIoSizes(), main(), kaldi::nnet3::MergeIo(), NnetIoStructureCompare::operator()(), NnetIo::operator==(), kaldi::nnet3::PerturbImageInNnetExample(), NnetComputeProb::ProcessOutputs(), NnetTrainer::ProcessOutputs(), NnetIo::Read(), NnetIo::Swap(), and NnetIo::Write().