47 if (
name != other.
name)
return false;
92 int32 num_rows = labels.size();
108 int32 size = io.size();
121 if (size <= 0 || size > 1000000)
125 io[
i].
Read(is, binary);
131 std::vector<NnetIo>::iterator iter = io.begin(), end = io.end();
134 for (; iter != end; ++iter)
135 iter->features.Compress();
140 const NnetIo &io)
const noexcept {
145 size_t ans = string_hasher(io.name) +
146 indexes_hasher(io.indexes) +
147 19249 * io.features.NumRows() +
148 14731 * io.features.NumCols();
166 size_t size = eg.io.size(), ans = size * 35099;
167 for (
size_t i = 0;
i < size;
i++)
168 ans = ans * 19157 + io_hasher(eg.io[
i]);
175 if (a.
io.size() != b.
io.size())
177 size_t size = a.
io.size();
178 for (
size_t i = 0;
i < size;
i++)
179 if (!io_compare(a.
io[
i], b.
io[
i]))
NnetExample is the input data and corresponding label (or labels) for one or more frames of input...
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void WriteIndexVector(std::ostream &os, bool binary, const std::vector< Index > &vec)
This class is a wrapper that enables you to store a matrix in one of three forms: either as a Matrix<...
void GetMatrix(Matrix< BaseFloat > *mat) const
Outputs the contents as a matrix.
Base class which provides matrix operations not involving resizing or allocation. ...
void ReadBasicType(std::istream &is, bool binary, T *t)
ReadBasicType is the name of the read function for bool, integer types, and floating-point types...
bool operator==(const NnetIo &other) const
void ReadToken(std::istream &is, bool binary, std::string *str)
ReadToken gets the next token and puts it in str (exception on failure).
GeneralMatrix features
The features or labels.
bool operator()(const NnetExample &a, const NnetExample &b) const
std::vector< Index > indexes
"indexes" is a vector the same length as features.NumRows(), explaining the meaning of each row of th...
A hashing function object for strings.
void Read(std::istream &is, bool binary)
Note: if you write a compressed matrix in text form, it will be read as a regular full matrix...
void Swap(GeneralMatrix *other)
MatrixIndexT NumCols() const
std::vector< std::vector< std::pair< int32, BaseFloat > > > Posterior
Posterior is a typedef for storing acoustic-state (actually, transition-id) posteriors over an uttera...
static void ExpectToken(const std::string &token, const std::string &what_we_are_parsing, const std::string **next_token)
void Write(std::ostream &os, bool binary) const
bool operator()(const NnetIo &a, const NnetIo &b) const
size_t operator()(const NnetIo &a) const noexcept
void Compress()
Compresses any (input) features that are not sparse.
void WriteToken(std::ostream &os, bool binary, const char *token)
The WriteToken functions are for writing nonempty sequences of non-space characters.
void ReadIndexVector(std::istream &is, bool binary, std::vector< Index > *vec)
#define KALDI_ASSERT(cond)
This comparison object compares just the structural aspects of the NnetIo object (name, indexes, feature dimension) without looking at the value of features.
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix).
MatrixIndexT NumRows() const
void Read(std::istream &is, bool binary)
void Read(std::istream &is, bool binary)
This hashing object hashes just the structural aspects of the NnetIo object (name, indexes, feature dimension) without looking at the value of features.
size_t operator()(const NnetExample &eg) const noexcept
void WriteBasicType(std::ostream &os, bool binary, T t)
WriteBasicType is the name of the write function for bool, integer types, and floating-point types...
std::string name
the name of the input in the neural net; in simple setups it will just be "input".
std::vector< NnetIo > io
"io" contains the input and output.
static bool ApproxEqual(float a, float b, float relative_tolerance=0.001)
return abs(a - b) <= relative_tolerance * (abs(a)+abs(b)).
void Write(std::ostream &os, bool binary) const
void Write(std::ostream &os, bool binary) const