21 #ifndef KALDI_NNET3_NNET_COMMON_H_ 22 #define KALDI_NNET3_NNET_COMMON_H_ 53 return n == a.
n && t == a.
t && x == a.
x;
56 return n != a.
n || t != a.
t || x != a.
x;
59 if (t < a.
t) {
return true; }
60 else if (t > a.
t) {
return false; }
61 else if (x < a.
x) {
return true; }
62 else if (x > a.
x) {
return false; }
63 else return (n < a.
n);
66 return Index(n+other.
n, t+other.
t, x+other.
x);
75 void Write(std::ostream &os,
bool binary)
const;
77 void Read(std::istream &os,
bool binary);
91 inline bool operator ()(
const Index &a,
const Index &b)
const {
92 if (a.
n < b.
n) {
return true; }
93 else if (a.
n > b.
n) {
return false; }
94 else if (a.
x < b.
x) {
return true; }
95 else if (a.
x > b.
x) {
return false; }
96 else return (a.
t < b.
t);
106 const std::vector<Index> &vec);
109 std::vector<Index> *vec);
118 size_t operator () (
const Index &cindex)
const noexcept;
122 size_t operator () (
const Cindex &cindex)
const noexcept;
126 size_t operator () (
const std::vector<Cindex> &cindex_vector)
const noexcept;
132 size_t operator () (
const std::vector<Index> &index_vector)
const noexcept;
138 void PrintCindex(std::ostream &ostream,
const Cindex &cindex,
139 const std::vector<std::string> &node_names);
149 const std::vector<Index> &indexes);
159 const std::vector<Cindex> &cindexes,
160 const std::vector<std::string> &node_names);
164 std::vector<Cindex> *out);
167 const std::vector<Cindex> &vec);
170 std::vector<Cindex> *vec);
176 const std::vector<int32> &ints);
180 std::ostream &
operator << (std::ostream &ostream,
const Cindex &cindex);
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)
bool operator<(const Index &a) const
Abstract base-class for neural-net components.
void PrintCindex(std::ostream &os, const Cindex &cindex, const std::vector< std::string > &node_names)
void ReadCindexVector(std::istream &is, bool binary, std::vector< Cindex > *vec)
void PrintIndexes(std::ostream &os, const std::vector< Index > &indexes)
this will only be used for pretty-printing.
std::ostream & operator<<(std::ostream &ostream, const Index &index)
struct Index is intended to represent the various indexes by which we number the rows of the matrices...
std::pair< int32, Index > Cindex
void Read(std::istream &os, bool binary)
void WriteCindexVector(std::ostream &os, bool binary, const std::vector< Cindex > &vec)
bool operator==(const Index &a) const
bool operator!=(const Index &a) const
void Write(std::ostream &os, bool binary) const
Index(int32 n, int32 t, int32 x=0)
void PrintIntegerVector(std::ostream &os, const std::vector< int32 > &ints)
void AppendCindexes(int32 node, const std::vector< Index > &indexes, std::vector< Cindex > *out)
Appends to 'out' the pairs (node, indexes[0]), (node, indexes[1]), ...
void ReadIndexVector(std::istream &is, bool binary, std::vector< Index > *vec)
void PrintCindexes(std::ostream &ostream, const std::vector< Cindex > &cindexes, const std::vector< std::string > &node_names)
this will only be used for pretty-printing.
Index & operator+=(const Index &other)
Index operator+(const Index &other) const