All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
I/O related functions and classes

Various namespace-scope functions for I/O. More...

Classes

struct  HtkHeader
 A structure containing the HTK header. More...
 

Functions

template<typename Real >
bool ReadHtk (std::istream &is, Matrix< Real > *M, HtkHeader *header_ptr)
 
template<typename Real >
bool WriteHtk (std::ostream &os, const MatrixBase< Real > &M, HtkHeader htk_hdr)
 
template<typename Real >
bool WriteSphinx (std::ostream &os, const MatrixBase< Real > &M)
 
template<typename Real >
std::ostream & operator<< (std::ostream &os, const MatrixBase< Real > &M)
 
template<typename Real >
std::istream & operator>> (std::istream &is, MatrixBase< Real > &M)
 
template<typename Real >
std::istream & operator>> (std::istream &is, Matrix< Real > &M)
 
template<typename Real >
bool SameDim (const MatrixBase< Real > &M, const MatrixBase< Real > &N)
 
template<typename Real >
std::ostream & operator<< (std::ostream &os, const VectorBase< Real > &rv)
 
template<typename Real >
std::istream & operator>> (std::istream &in, VectorBase< Real > &v)
 Input from a C++ stream. More...
 
template<typename Real >
std::istream & operator>> (std::istream &in, Vector< Real > &v)
 Input from a C++ stream. More...
 
template<typename Real >
std::ostream & operator<< (std::ostream &out, const PackedMatrix< Real > &M)
 
template<typename Real >
std::istream & operator>> (std::istream &is, PackedMatrix< Real > &M)
 

Detailed Description

Various namespace-scope functions for I/O.

end of "addtogroup matrix_group"

Output to a C++ stream.

Note that the << and >> operators are not recommended for normal use in Kaldi-style I/O (for that, use the Read and Write methods). The operators are mainly useful for logging and error output.

Non-binary by default (use Write for binary output).

Function Documentation

std::ostream & operator<< ( std::ostream &  os,
const VectorBase< Real > &  rv 
)

Definition at line 30 of file kaldi-vector-inl.h.

30  {
31  rv.Write(os, false);
32  return os;
33 }
std::ostream & operator<< ( std::ostream &  out,
const PackedMatrix< Real > &  M 
)

Definition at line 181 of file packed-matrix.h.

181  {
182  M.Write(os, false);
183  return os;
184 }
std::ostream & operator<< ( std::ostream &  os,
const MatrixBase< Real > &  M 
)
inline

Definition at line 41 of file kaldi-matrix-inl.h.

41  {
42  M.Write(os, false);
43  return os;
44 }
std::istream & operator>> ( std::istream &  in,
VectorBase< Real > &  v 
)

Input from a C++ stream.

Will automatically read text or binary data from the stream.

Definition at line 36 of file kaldi-vector-inl.h.

References VectorBase< Real >::Read().

36  {
37  rv.Read(is, false);
38  return is;
39 }
std::istream & operator>> ( std::istream &  in,
Vector< Real > &  v 
)

Input from a C++ stream.

Will automatically read text or binary data from the stream.

Definition at line 42 of file kaldi-vector-inl.h.

References Vector< Real >::Read().

42  {
43  rv.Read(is, false);
44  return is;
45 }
std::istream & operator>> ( std::istream &  is,
Matrix< Real > &  M 
)
inline

Definition at line 47 of file kaldi-matrix-inl.h.

References Matrix< Real >::Read().

47  {
48  M.Read(is, false);
49  return is;
50 }
std::istream & operator>> ( std::istream &  is,
MatrixBase< Real > &  M 
)
inline

Definition at line 54 of file kaldi-matrix-inl.h.

References MatrixBase< Real >::Read().

54  {
55  M.Read(is, false);
56  return is;
57 }
std::istream& kaldi::operator>> ( std::istream &  is,
PackedMatrix< Real > &  M 
)

Definition at line 187 of file packed-matrix.h.

187  {
188  M.Read(is, false);
189  return is;
190 }
bool kaldi::ReadHtk ( std::istream &  is,
Matrix< Real > *  M,
HtkHeader *  header_ptr 
)
bool kaldi::SameDim ( const MatrixBase< Real > &  M,
const MatrixBase< Real > &  N 
)

Definition at line 1065 of file kaldi-matrix.h.

References MatrixBase< Real >::NumCols(), and MatrixBase< Real >::NumRows().

Referenced by Fmpe::AccStats(), CuMatrixBase< Real >::AddDiagVecMat(), MatrixBase< Real >::AddDiagVecMat(), CuMatrixBase< Real >::AddMatDiagVec(), MatrixBase< Real >::AddMatDiagVec(), CuMatrixBase< Real >::AddMatMatElements(), CuMatrixBase< Real >::ApplyLogSoftMaxPerRow(), CuMatrixBase< Real >::ApplySoftMaxPerRow(), kaldi::nnet3::attention::AttentionBackward(), RestrictedAttentionComponent::Backprop(), BatchNormComponent::Backprop(), LogSoftmaxComponent::Backprop(), GeneralDropoutComponent::Backprop(), DropoutComponent::Backprop(), ScaleAndOffsetComponent::Backprop(), kaldi::cu::BackpropLstmNonlinearity(), RestrictedAttentionComponent::BackpropOneHead(), NnetUpdater::ComputeObjfAndDeriv(), kaldi::cu::CpuBackpropLstmNonlinearity(), CuMatrixBase< Real >::DiffLogSoftmaxPerRow(), CuMatrixBase< Real >::DiffSigmoid(), MatrixBase< Real >::DiffSigmoid(), CuMatrixBase< Real >::DiffSoftmaxPerRow(), MatrixBase< Real >::DiffTanh(), kaldi::cu::EnsureNonzero(), CuMatrixBase< Real >::Heaviside(), MatrixBase< Real >::Heaviside(), kaldi::cu::NormalizePerRow(), kaldi::nnet2::PreconditionDirections(), BatchNormComponent::Propagate(), GeneralDropoutComponent::Propagate(), kaldi::cu::RegularizeL1(), CuMatrixBase< Real >::Sigmoid(), MatrixBase< Real >::Sigmoid(), kaldi::SlidingWindowCmn(), CuMatrixBase< Real >::SoftHinge(), MatrixBase< Real >::SoftHinge(), CuMatrixBase< Real >::Tanh(), MatrixBase< Real >::Tanh(), kaldi::TypeOneUsage(), and Fmpe::Update().

1065  {
1066  return (M.NumRows() == N.NumRows() && M.NumCols() == N.NumCols());
1067 }
bool kaldi::WriteHtk ( std::ostream &  os,
const MatrixBase< Real > &  M,
HtkHeader  htk_hdr 
)
bool kaldi::WriteSphinx ( std::ostream &  os,
const MatrixBase< Real > &  M 
)

Referenced by main().