These functions are provided to write fundamental types, strings, and a few STL types to and from C++ streams; see Input/output mechanisms for fundamental types and STL types for how this fits into the bigger picture of Kaldi-style I/O. More...
Functions | |
template<class T > | |
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. More... | |
template<class T > | |
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. More... | |
template<> | |
void | WriteBasicType< bool > (std::ostream &os, bool binary, bool b) |
template<> | |
void | ReadBasicType< bool > (std::istream &is, bool binary, bool *b) |
template<> | |
void | WriteBasicType< float > (std::ostream &os, bool binary, float f) |
template<> | |
void | WriteBasicType< double > (std::ostream &os, bool binary, double f) |
template<> | |
void | ReadBasicType< float > (std::istream &is, bool binary, float *f) |
template<> | |
void | ReadBasicType< double > (std::istream &is, bool binary, double *d) |
template<class T > | |
void | ReadBasicType (std::istream &is, bool binary, T *t, bool add) |
template<class T > | |
void | WriteIntegerVector (std::ostream &os, bool binary, const std::vector< T > &v) |
Function for writing STL vectors of integer types. More... | |
template<class T > | |
void | ReadIntegerVector (std::istream &is, bool binary, std::vector< T > *v) |
Function for reading STL vector of integer types. More... | |
template<class T > | |
void | WriteIntegerPairVector (std::ostream &os, bool binary, const std::vector< std::pair< T, T > > &v) |
Function for writing STL vectors of pairs of integer types. More... | |
template<class T > | |
void | ReadIntegerPairVector (std::istream &is, bool binary, std::vector< std::pair< T, T > > *v) |
Function for reading STL vector of pairs of integer types. More... | |
void | WriteToken (std::ostream &os, bool binary, const char *token) |
The WriteToken functions are for writing nonempty sequences of non-space characters. More... | |
void | WriteToken (std::ostream &os, bool binary, const std::string &token) |
int | Peek (std::istream &is, bool binary) |
Peek consumes whitespace (if binary == false) and then returns the peek() value of the stream. More... | |
void | ReadToken (std::istream &is, bool binary, std::string *token) |
ReadToken gets the next token and puts it in str (exception on failure). More... | |
int | PeekToken (std::istream &is, bool binary) |
PeekToken will return the first character of the next token, or -1 if end of file. More... | |
void | ExpectToken (std::istream &is, bool binary, const char *token) |
ExpectToken tries to read in the given token, and throws an exception on failure. More... | |
void | ExpectToken (std::istream &is, bool binary, const std::string &token) |
void | ExpectPretty (std::istream &is, bool binary, const char *token) |
ExpectPretty attempts to read the text in "token", but only in non-binary mode. More... | |
void | ExpectPretty (std::istream &is, bool binary, const std::string &token) |
These functions are provided to write fundamental types, strings, and a few STL types to and from C++ streams; see Input/output mechanisms for fundamental types and STL types for how this fits into the bigger picture of Kaldi-style I/O.
void kaldi::ExpectPretty | ( | std::istream & | is, |
bool | binary, | ||
const char * | token | ||
) |
ExpectPretty attempts to read the text in "token", but only in non-binary mode.
Throws exception on failure. It expects an exact match except that arbitrary whitespace matches arbitrary whitespace.
Referenced by kaldi::ReadBasicType().
void kaldi::ExpectPretty | ( | std::istream & | is, |
bool | binary, | ||
const std::string & | token | ||
) |
void ExpectToken | ( | std::istream & | is, |
bool | binary, | ||
const char * | token | ||
) |
ExpectToken tries to read in the given token, and throws an exception on failure.
Definition at line 191 of file io-funcs.cc.
References kaldi::CheckToken(), KALDI_ASSERT, and KALDI_ERR.
Referenced by kaldi::nnet2::ExpectOneOrTwoTokens(), kaldi::ExpectOneOrTwoTokens(), kaldi::ExpectToken(), Component::Init(), AccumAmDiagGmm::Read(), AffineXformStats::Read(), CompressedAffineXformStats::Read(), MlltAccs::Read(), ScalarClusterable::Read(), NnetExample::Read(), RegressionTree::Read(), QuestionsForKey::Read(), CuBlockMatrix< Real >::Read(), RegtreeMllrDiagGmm::Read(), LogisticRegression::Read(), LinearVtln::Read(), AmDiagGmm::Read(), ContextDependency::Read(), BasisFmllrAccus::Read(), AccumFullGmm::Read(), LdaEstimate::Read(), RegtreeFmllrDiagGmm::Read(), Sgmm2FmllrGlobalParams::Read(), GaussClusterable::Read(), SparseVector< Real >::Read(), AccumDiagGmm::Read(), BasisFmllrEstimate::Read(), Questions::Read(), RegtreeMllrDiagGmmAccs::Read(), FmllrSgmm2Accs::Read(), DiscriminativeSupervision::Read(), MleAmSgmm2Accs::Read(), HmmTopology::Read(), FullGmm::Read(), TransitionModel::Read(), RefineClustersOptions::Read(), Plda::Read(), VectorClusterable::Read(), Component::Read(), EventMap::Read(), DiagGmm::Read(), GrammarFst::Read(), DiscriminativeNnetExample::Read(), RegtreeFmllrDiagGmmAccs::Read(), SparseMatrix< float >::Read(), ConstantEventMap::Read(), OnlineGmmAdaptationState::Read(), Nnet::Read(), AmSgmm2::Read(), OnlineIvectorExtractorAdaptationState::Read(), IvectorExtractor::Read(), TableEventMap::Read(), OnlineCmvnState::Read(), SplitEventMap::Read(), NonlinearComponent::Read(), OnlineIvectorEstimationStats::Read(), MaxoutComponent::Read(), MaxpoolingComponent::Read(), IvectorExtractorStats::Read(), PnormComponent::Read(), Sgmm2GauPost::Read(), PowerComponent::Read(), ScaleComponent::Read(), AffineComponent::Read(), AffineComponentPreconditioned::Read(), AffineComponentPreconditionedOnline::Read(), SpliceComponent::Read(), SpliceMaxComponent::Read(), BlockAffineComponent::Read(), BlockAffineComponentPreconditioned::Read(), PermuteComponent::Read(), DctComponent::Read(), FixedLinearComponent::Read(), FixedAffineComponent::Read(), FixedScaleComponent::Read(), FixedBiasComponent::Read(), DropoutComponent::Read(), AdditiveNoiseComponent::Read(), Convolutional1dComponent::Read(), kaldi::ReadBasicType(), kaldi::ReadBuildTreeStats(), AveragePoolingComponent::ReadData(), MaxPoolingComponent::ReadData(), ParametricRelu::ReadData(), SimpleSentenceAveragingComponent::ReadData(), AffineTransform::ReadData(), RecurrentComponent::ReadData(), LinearTransform::ReadData(), LstmProjected::ReadData(), ParallelComponent::ReadData(), FramePoolingComponent::ReadData(), ConvolutionalComponent::ReadData(), BlstmProjected::ReadData(), MultiBasisComponent::ReadData(), Dropout::ReadData(), AddShift::ReadData(), Rescale::ReadData(), kaldi::ReadEventType(), ConstArpaLm::ReadInternal(), TreeRenderer::Render(), TreeRenderer::RenderConstant(), TreeRenderer::RenderSplit(), TreeRenderer::RenderSubTree(), TreeRenderer::RenderTable(), kaldi::UnitTestIo(), kaldi::UnitTestIoNew(), and kaldi::UnitTestIoPipe().
void ExpectToken | ( | std::istream & | is, |
bool | binary, | ||
const std::string & | token | ||
) |
Definition at line 214 of file io-funcs.cc.
References kaldi::ExpectToken().
int Peek | ( | std::istream & | is, |
bool | binary | ||
) |
Peek consumes whitespace (if binary == false) and then returns the peek() value of the stream.
Definition at line 145 of file io-funcs.cc.
Referenced by CuBlockMatrix< Real >::Read(), CompressedMatrix::Read(), PackedMatrix< float >::Read(), Component::Read(), EventMap::Read(), Vector< float >::Read(), Matrix< BaseFloat >::Read(), kaldi::ReadBasicType(), ParametricRelu::ReadData(), AffineTransform::ReadData(), SimpleSentenceAveragingComponent::ReadData(), RecurrentComponent::ReadData(), LinearTransform::ReadData(), LstmProjected::ReadData(), BlstmProjected::ReadData(), MultiBasisComponent::ReadData(), Dropout::ReadData(), AddShift::ReadData(), Rescale::ReadData(), TreeRenderer::RenderSubTree(), kaldi::UnitTestIo(), kaldi::UnitTestIoNew(), and kaldi::UnitTestIoPipe().
int PeekToken | ( | std::istream & | is, |
bool | binary | ||
) |
PeekToken will return the first character of the next token, or -1 if end of file.
It's the same as Peek(), except if the first character is '<' it will skip over it and will return the next character. It will attempt to unget the '<' so the stream is where it was before you did PeekToken(), however, this is not guaranteed (see ReadToken()).
Definition at line 170 of file io-funcs.cc.
Referenced by NnetOptimizeOptions::Read(), Component::Read(), Nnet::Read(), AffineComponent::Read(), BlockAffineComponent::Read(), RepeatedAffineComponent::Read(), NonlinearComponent::Read(), DropoutMaskComponent::Read(), NaturalGradientAffineComponent::Read(), GeneralDropoutComponent::Read(), LinearComponent::Read(), SpecAugmentTimeMaskComponent::Read(), NoOpComponent::Read(), PerElementScaleComponent::Read(), PerElementOffsetComponent::Read(), kaldi::ReadBasicType(), ParametricRelu::ReadData(), AffineTransform::ReadData(), SimpleSentenceAveragingComponent::ReadData(), RecurrentComponent::ReadData(), LinearTransform::ReadData(), LstmProjected::ReadData(), ConvolutionalComponent::ReadData(), BlstmProjected::ReadData(), MultiBasisComponent::ReadData(), Dropout::ReadData(), kaldi::UnitTestIo(), and kaldi::UnitTestIoPipe().
|
inline |
ReadBasicType is the name of the read function for bool, integer types, and floating-point types.
They all throw on error.
Definition at line 55 of file io-funcs-inl.h.
References rnnlm::i, KALDI_ASSERT_IS_INTEGER_TYPE, KALDI_ERR, and KALDI_PARANOID_ASSERT.
Referenced by LstmNonlinearityComponent::ConsolidateMemory(), Component::Init(), AffineTransform::InitData(), LinearTransform::InitData(), MultiBasisComponent::InitData(), ParametricRelu::InitData(), RecurrentComponent::InitData(), AveragePoolingComponent::InitData(), MaxPoolingComponent::InitData(), FramePoolingComponent::InitData(), SimpleSentenceAveragingComponent::InitData(), LstmProjected::InitData(), BlstmProjected::InitData(), ConvolutionalComponent::InitData(), Rbm::InitData(), SentenceAveragingComponent::InitData(), Dropout::InitData(), AddShift::InitData(), Rescale::InitData(), AccumAmDiagGmm::Read(), AffineXformStats::Read(), CompressedAffineXformStats::Read(), MlltAccs::Read(), ScalarClusterable::Read(), NnetExample::Read(), RegressionTree::Read(), AmNnetSimple::Read(), QuestionsForKey::Read(), CuBlockMatrix< Real >::Read(), RegtreeMllrDiagGmm::Read(), LinearVtln::Read(), AmDiagGmm::Read(), Index::Read(), DistributeComponent::Read(), ContextDependency::Read(), FmpeOptions::Read(), BasisFmllrAccus::Read(), AccumFullGmm::Read(), LdaEstimate::Read(), RegtreeFmllrDiagGmm::Read(), Sgmm2FmllrGlobalParams::Read(), IoSpecification::Read(), GaussClusterable::Read(), NormalizeComponent::Read(), SparseVector< Real >::Read(), GaussPostHolder::Read(), AccumDiagGmm::Read(), NnetDiscriminativeExample::Read(), BasisFmllrEstimate::Read(), NnetChainExample::Read(), Questions::Read(), RegtreeMllrDiagGmmAccs::Read(), FmllrSgmm2Accs::Read(), DiscriminativeSupervision::Read(), MleAmSgmm2Accs::Read(), HmmTopology::Read(), TransitionModel::Read(), RefineClustersOptions::Read(), VectorClusterable::Read(), BasicHolder< BasicType >::Read(), PackedMatrix< float >::Read(), NnetOptimizeOptions::Read(), Component::Read(), RestrictedAttentionComponent::Read(), ComputationRequest::Read(), ConvolutionComponent::Read(), GrammarFst::Read(), DiscriminativeNnetExample::Read(), RegtreeFmllrDiagGmmAccs::Read(), ElementwiseProductComponent::Read(), SparseMatrix< float >::Read(), ConstantEventMap::Read(), BatchNormComponent::Read(), StatisticsExtractionComponent::Read(), Nnet::Read(), AmSgmm2::Read(), ConvolutionModel::Read(), TimeHeightConvolutionComponent::Read(), IvectorExtractor::Read(), TableEventMap::Read(), BasicVectorHolder< BasicType >::Read(), SplitEventMap::Read(), NnetComputation::MatrixInfo::Read(), NnetComputation::MatrixDebugInfo::Read(), NnetComputation::SubMatrixInfo::Read(), ConvolutionComputation::Read(), LstmNonlinearityComponent::Read(), NnetComputation::Command::Read(), NonlinearComponent::Read(), StatisticsPoolingComponent::Read(), OnlineIvectorEstimationStats::Read(), BasicVectorVectorHolder< BasicType >::Read(), ConvolutionComputationIo::Read(), MaxoutComponent::Read(), Vector< float >::Read(), NnetComputation::Read(), TdnnComponent::Read(), MaxpoolingComponent::Read(), IvectorExtractorStats::Read(), BackpropTruncationComponent::Read(), TdnnComponent::PrecomputedIndexes::Read(), BasicPairVectorHolder< BasicType >::Read(), PnormComponent::Read(), Sgmm2GauPost::Read(), BackpropTruncationComponentPrecomputedIndexes::Read(), RepeatedAffineComponent::Read(), ComputationCache::Read(), PowerComponent::Read(), ConstantComponent::Read(), ScaleComponent::Read(), DropoutMaskComponent::Read(), NaturalGradientAffineComponent::Read(), Matrix< BaseFloat >::Read(), AffineComponent::Read(), GeneralDropoutComponent::Read(), LinearComponent::Read(), AffineComponentPreconditioned::Read(), GeneralDropoutComponentPrecomputedIndexes::Read(), AffineComponentPreconditionedOnline::Read(), SpecAugmentTimeMaskComponent::Read(), SpecAugmentTimeMaskComponentPrecomputedIndexes::Read(), SpliceComponent::Read(), SpliceMaxComponent::Read(), NoOpComponent::Read(), BlockAffineComponent::Read(), SumBlockComponent::Read(), BlockAffineComponentPreconditioned::Read(), ClipGradientComponent::Read(), DctComponent::Read(), PerElementScaleComponent::Read(), DropoutComponent::Read(), PerElementOffsetComponent::Read(), AdditiveNoiseComponent::Read(), ConstantFunctionComponent::Read(), Convolutional1dComponent::Read(), NaturalGradientPerElementScaleComponent::Read(), ScaleAndOffsetComponent::Read(), CompositeComponent::Read(), kaldi::ReadBasicType(), kaldi::ReadBasicType< double >(), kaldi::ReadBasicType< float >(), kaldi::ReadBuildTreeStats(), kaldi::nnet3::ReadCindexVector(), kaldi::nnet3::ReadCindexVectorElementBinary(), AveragePoolingComponent::ReadData(), MaxPoolingComponent::ReadData(), ParametricRelu::ReadData(), AffineTransform::ReadData(), SimpleSentenceAveragingComponent::ReadData(), RecurrentComponent::ReadData(), LinearTransform::ReadData(), LstmProjected::ReadData(), ParallelComponent::ReadData(), FramePoolingComponent::ReadData(), ConvolutionalComponent::ReadData(), BlstmProjected::ReadData(), MultiBasisComponent::ReadData(), Dropout::ReadData(), AddShift::ReadData(), Rescale::ReadData(), kaldi::ReadEventType(), fst::ReadILabelInfo(), kaldi::nnet3::ReadIndexVector(), kaldi::nnet3::ReadIndexVectorElementBinary(), ConstArpaLm::ReadInternal(), ConstArpaLm::ReadInternalOldFormat(), kaldi::ReadPosterior(), UpdatableComponent::ReadUpdatableCommon(), TreeRenderer::Render(), TreeRenderer::RenderConstant(), TreeRenderer::RenderSplit(), TreeRenderer::RenderTable(), kaldi::UnitTestIo(), kaldi::UnitTestIoNew(), and kaldi::UnitTestIoPipe().
Definition at line 169 of file io-funcs.h.
References kaldi::ExpectPretty(), kaldi::ExpectToken(), kaldi::InitKaldiInputStream(), kaldi::InitKaldiOutputStream(), kaldi::Peek(), kaldi::PeekToken(), kaldi::ReadBasicType(), kaldi::ReadIntegerPairVector(), kaldi::ReadIntegerVector(), kaldi::ReadToken(), kaldi::WriteIntegerPairVector(), kaldi::WriteIntegerVector(), and kaldi::WriteToken().
void ReadBasicType< bool > | ( | std::istream & | is, |
bool | binary, | ||
bool * | b | ||
) |
Definition at line 34 of file io-funcs.cc.
References kaldi::CharToString(), KALDI_ERR, and KALDI_PARANOID_ASSERT.
void ReadBasicType< double > | ( | std::istream & | is, |
bool | binary, | ||
double * | d | ||
) |
Definition at line 98 of file io-funcs.cc.
References rnnlm::d, KALDI_ERR, KALDI_PARANOID_ASSERT, and kaldi::ReadBasicType().
void ReadBasicType< float > | ( | std::istream & | is, |
bool | binary, | ||
float * | f | ||
) |
Definition at line 73 of file io-funcs.cc.
References rnnlm::d, KALDI_ERR, KALDI_PARANOID_ASSERT, and kaldi::ReadBasicType().
|
inline |
Function for reading STL vector of pairs of integer types.
Definition at line 131 of file io-funcs-inl.h.
References KALDI_ASSERT, KALDI_ASSERT_IS_INTEGER_TYPE, and KALDI_ERR.
Referenced by DistributeComponentPrecomputedIndexes::Read(), ConvolutionModel::Read(), StatisticsExtractionComponentPrecomputedIndexes::Read(), StatisticsPoolingComponentPrecomputedIndexes::Read(), NnetComputation::Read(), kaldi::ReadBasicType(), and kaldi::UnitTestIo().
|
inline |
Function for reading STL vector of integer types.
Definition at line 232 of file io-funcs-inl.h.
References KALDI_ASSERT, KALDI_ASSERT_IS_INTEGER_TYPE, and KALDI_ERR.
Referenced by kaldi::ConvertSpliceComponent(), FramePoolingComponent::InitData(), main(), NnetExample::Read(), RegressionTree::Read(), QuestionsForKey::Read(), RegtreeMllrDiagGmm::Read(), LogisticRegression::Read(), ConstIntegerSet< EventValueType >::Read(), RegtreeFmllrDiagGmm::Read(), DiscriminativeSupervision::Read(), HmmTopology::Read(), CuArray< Int32Pair >::Read(), DiscriminativeNnetExample::Read(), AmSgmm2::Read(), ConvolutionModel::Read(), StatisticsExtractionComponentPrecomputedIndexes::Read(), ConvolutionComputation::Read(), NnetComputation::Command::Read(), NnetComputation::Read(), TdnnComponent::Read(), TdnnComponent::PrecomputedIndexes::Read(), Sgmm2GauPost::Read(), SpecAugmentTimeMaskComponentPrecomputedIndexes::Read(), SpliceComponent::Read(), SpliceMaxComponent::Read(), SumGroupComponent::Read(), PermuteComponent::Read(), kaldi::ReadBasicType(), FramePoolingComponent::ReadData(), BlockSoftmax::ReadData(), fst::ReadILabelInfo(), kaldi::nnet3::ReadVectorAsChar(), kaldi::UnitTestIo(), kaldi::UnitTestIoNew(), and kaldi::UnitTestIoPipe().
void ReadToken | ( | std::istream & | is, |
bool | binary, | ||
std::string * | token | ||
) |
ReadToken gets the next token and puts it in str (exception on failure).
If PeekToken() had been previously called, it is possible that the stream had failed to unget the starting '<' character. In this case ReadToken() returns the token string without the leading '<'. You must be prepared to handle this case. ExpectToken() handles this internally, and is not affected.
Definition at line 154 of file io-funcs.cc.
References kaldi::CharToString(), KALDI_ASSERT, and KALDI_ERR.
Referenced by kaldi::nnet2::ExpectOneOrTwoTokens(), kaldi::ExpectOneOrTwoTokens(), Component::Init(), LinearTransform::InitData(), AffineTransform::InitData(), MultiBasisComponent::InitData(), ParallelComponent::InitData(), ParametricRelu::InitData(), Splice::InitData(), AveragePoolingComponent::InitData(), MaxPoolingComponent::InitData(), RecurrentComponent::InitData(), FramePoolingComponent::InitData(), SimpleSentenceAveragingComponent::InitData(), LstmProjected::InitData(), BlstmProjected::InitData(), ConvolutionalComponent::InitData(), Rbm::InitData(), BlockSoftmax::InitData(), CopyComponent::InitData(), SentenceAveragingComponent::InitData(), Dropout::InitData(), AddShift::InitData(), Rescale::InitData(), NnetExample::Read(), LogisticRegression::Read(), LinearVtln::Read(), NnetIo::Read(), ContextDependency::Read(), FmpeOptions::Read(), AccumFullGmm::Read(), LdaEstimate::Read(), NnetDiscriminativeSupervision::Read(), IoSpecification::Read(), Sgmm2FmllrGlobalParams::Read(), NormalizeComponent::Read(), NnetChainSupervision::Read(), AccumDiagGmm::Read(), DropoutComponent::Read(), Questions::Read(), MleAmSgmm2Accs::Read(), HmmTopology::Read(), TransitionModel::Read(), FullGmm::Read(), CompressedMatrix::Read(), PackedMatrix< float >::Read(), Component::Read(), ConvolutionComponent::Read(), DiagGmm::Read(), Nnet::Read(), AmSgmm2::Read(), NnetComputation::MatrixInfo::Read(), LstmNonlinearityComponent::Read(), OnlineIvectorEstimationStats::Read(), Vector< float >::Read(), NnetComputation::Read(), TdnnComponent::Read(), BackpropTruncationComponent::Read(), NonlinearComponent::Read(), ConstantComponent::Read(), NaturalGradientAffineComponent::Read(), Matrix< BaseFloat >::Read(), AffineComponent::Read(), AffineComponentPreconditioned::Read(), AffineComponentPreconditionedOnline::Read(), SpliceComponent::Read(), SpliceMaxComponent::Read(), NoOpComponent::Read(), SumGroupComponent::Read(), ClipGradientComponent::Read(), DctComponent::Read(), ConstantFunctionComponent::Read(), Convolutional1dComponent::Read(), NaturalGradientPerElementScaleComponent::Read(), CompositeComponent::Read(), kaldi::ReadBasicType(), ParametricRelu::ReadData(), AffineTransform::ReadData(), RecurrentComponent::ReadData(), LinearTransform::ReadData(), LstmProjected::ReadData(), BlstmProjected::ReadData(), MultiBasisComponent::ReadData(), Rbm::ReadData(), Dropout::ReadData(), ComponentPrecomputedIndexes::ReadNew(), Component::ReadNew(), UpdatableComponent::ReadUpdatableCommon(), kaldi::UnitTestIo(), kaldi::UnitTestIoNew(), and kaldi::UnitTestIoPipe().
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.
They all throw on error.
Definition at line 34 of file io-funcs-inl.h.
References KALDI_ASSERT_IS_INTEGER_TYPE, and KALDI_ERR.
Referenced by LstmNonlinearityComponent::ConsolidateMemory(), kaldi::TestBuildTree(), kaldi::TestGenRandStats(), kaldi::UnitTestIo(), kaldi::UnitTestIoNew(), kaldi::UnitTestIoPipe(), AccumAmDiagGmm::Write(), ScalarClusterable::Write(), AffineXformStats::Write(), CompressedAffineXformStats::Write(), MlltAccs::Write(), NnetExample::Write(), AmNnetSimple::Write(), RegressionTree::Write(), CuBlockMatrix< Real >::Write(), QuestionsForKey::Write(), RegtreeMllrDiagGmm::Write(), Index::Write(), LinearVtln::Write(), AmDiagGmm::Write(), GaussClusterable::Write(), FmpeOptions::Write(), DistributeComponent::Write(), BasisFmllrAccus::Write(), AccumFullGmm::Write(), RegtreeFmllrDiagGmm::Write(), LdaEstimate::Write(), ContextDependency::Write(), Sgmm2FmllrGlobalParams::Write(), IoSpecification::Write(), NormalizeComponent::Write(), SparseVector< Real >::Write(), GaussPostHolder::Write(), NnetDiscriminativeExample::Write(), AccumDiagGmm::Write(), BasisFmllrEstimate::Write(), NnetChainExample::Write(), Questions::Write(), RegtreeMllrDiagGmmAccs::Write(), FmllrSgmm2Accs::Write(), DiscriminativeSupervision::Write(), BasicHolder< BasicType >::Write(), HmmTopology::Write(), MleAmSgmm2Accs::Write(), RefineClustersOptions::Write(), TransitionModel::Write(), VectorClusterable::Write(), PackedMatrix< float >::Write(), NnetOptimizeOptions::Write(), RestrictedAttentionComponent::Write(), ComputationRequest::Write(), Component::Write(), GrammarFst::Write(), ConvolutionComponent::Write(), DiscriminativeNnetExample::Write(), RegtreeFmllrDiagGmmAccs::Write(), ElementwiseProductComponent::Write(), SparseMatrix< float >::Write(), ConstantEventMap::Write(), BatchNormComponent::Write(), BasicVectorHolder< BasicType >::Write(), Nnet::Write(), ConvolutionModel::Write(), AmSgmm2::Write(), StatisticsExtractionComponent::Write(), TimeHeightConvolutionComponent::Write(), IvectorExtractor::Write(), TableEventMap::Write(), ConstArpaLm::Write(), SplitEventMap::Write(), NnetComputation::MatrixInfo::Write(), NnetComputation::MatrixDebugInfo::Write(), NnetComputation::SubMatrixInfo::Write(), ConvolutionComputation::Write(), BasicVectorVectorHolder< BasicType >::Write(), LstmNonlinearityComponent::Write(), NnetComputation::Command::Write(), VectorBase< float >::Write(), NonlinearComponent::Write(), OnlineIvectorEstimationStats::Write(), StatisticsPoolingComponent::Write(), ConvolutionComputationIo::Write(), MaxoutComponent::Write(), NnetComputation::Write(), TdnnComponent::Write(), BasicPairVectorHolder< BasicType >::Write(), MaxpoolingComponent::Write(), IvectorExtractorStats::Write(), BackpropTruncationComponent::Write(), TdnnComponent::PrecomputedIndexes::Write(), PnormComponent::Write(), Sgmm2GauPost::Write(), BackpropTruncationComponentPrecomputedIndexes::Write(), RepeatedAffineComponent::Write(), ComputationCache::Write(), ConstantComponent::Write(), PowerComponent::Write(), ScaleComponent::Write(), DropoutMaskComponent::Write(), MatrixBase< float >::Write(), NaturalGradientAffineComponent::Write(), AffineComponent::Write(), GeneralDropoutComponent::Write(), LinearComponent::Write(), AffineComponentPreconditioned::Write(), GeneralDropoutComponentPrecomputedIndexes::Write(), AffineComponentPreconditionedOnline::Write(), SpecAugmentTimeMaskComponent::Write(), SpecAugmentTimeMaskComponentPrecomputedIndexes::Write(), SpliceComponent::Write(), SpliceMaxComponent::Write(), NoOpComponent::Write(), BlockAffineComponent::Write(), SumBlockComponent::Write(), BlockAffineComponentPreconditioned::Write(), ClipGradientComponent::Write(), DctComponent::Write(), DropoutComponent::Write(), PerElementOffsetComponent::Write(), AdditiveNoiseComponent::Write(), ConstantFunctionComponent::Write(), Convolutional1dComponent::Write(), NaturalGradientPerElementScaleComponent::Write(), ScaleAndOffsetComponent::Write(), CompositeComponent::Write(), Rbm::WriteAsNnet(), kaldi::WriteBuildTreeStats(), kaldi::nnet3::WriteCindexVector(), kaldi::nnet3::WriteCindexVectorElementBinary(), AveragePoolingComponent::WriteData(), MaxPoolingComponent::WriteData(), ParametricRelu::WriteData(), SimpleSentenceAveragingComponent::WriteData(), AffineTransform::WriteData(), RecurrentComponent::WriteData(), LinearTransform::WriteData(), ParallelComponent::WriteData(), LstmProjected::WriteData(), FramePoolingComponent::WriteData(), MultiBasisComponent::WriteData(), ConvolutionalComponent::WriteData(), BlstmProjected::WriteData(), Dropout::WriteData(), AddShift::WriteData(), Rescale::WriteData(), kaldi::WriteEventType(), fst::WriteILabelInfo(), kaldi::nnet3::WriteIndexVector(), kaldi::nnet3::WriteIndexVectorElementBinary(), kaldi::WritePosterior(), and UpdatableComponent::WriteUpdatableCommon().
void WriteBasicType< bool > | ( | std::ostream & | os, |
bool | binary, | ||
bool | b | ||
) |
void WriteBasicType< double > | ( | std::ostream & | os, |
bool | binary, | ||
double | f | ||
) |
Definition at line 62 of file io-funcs.cc.
void WriteBasicType< float > | ( | std::ostream & | os, |
bool | binary, | ||
float | f | ||
) |
Definition at line 51 of file io-funcs.cc.
|
inline |
Function for writing STL vectors of pairs of integer types.
Definition at line 93 of file io-funcs-inl.h.
References KALDI_ASSERT, KALDI_ASSERT_IS_INTEGER_TYPE, and KALDI_ERR.
Referenced by kaldi::ReadBasicType(), kaldi::UnitTestIo(), DistributeComponentPrecomputedIndexes::Write(), ConvolutionModel::Write(), StatisticsExtractionComponentPrecomputedIndexes::Write(), StatisticsPoolingComponentPrecomputedIndexes::Write(), and NnetComputation::Write().
|
inline |
Function for writing STL vectors of integer types.
Definition at line 198 of file io-funcs-inl.h.
References KALDI_ASSERT, KALDI_ASSERT_IS_INTEGER_TYPE, and KALDI_ERR.
Referenced by kaldi::ConvertAlignmentForPhone(), kaldi::GetIlabelMapping(), main(), kaldi::ProcessTopo(), kaldi::ReadBasicType(), kaldi::TestBuildTree(), kaldi::TestGenRandStats(), kaldi::UnitTestIo(), kaldi::UnitTestIoNew(), kaldi::UnitTestIoPipe(), NnetExample::Write(), RegressionTree::Write(), QuestionsForKey::Write(), RegtreeMllrDiagGmm::Write(), LogisticRegression::Write(), ConstIntegerSet< EventValueType >::Write(), RegtreeFmllrDiagGmm::Write(), DiscriminativeSupervision::Write(), HmmTopology::Write(), CuArray< Int32Pair >::Write(), DiscriminativeNnetExample::Write(), ConvolutionModel::Write(), AmSgmm2::Write(), StatisticsExtractionComponentPrecomputedIndexes::Write(), ConvolutionComputation::Write(), NnetComputation::Command::Write(), NnetComputation::Write(), TdnnComponent::Write(), TdnnComponent::PrecomputedIndexes::Write(), Sgmm2GauPost::Write(), SpecAugmentTimeMaskComponentPrecomputedIndexes::Write(), SpliceComponent::Write(), SpliceMaxComponent::Write(), SumGroupComponent::Write(), PermuteComponent::Write(), FramePoolingComponent::WriteData(), BlockSoftmax::WriteData(), fst::WriteILabelInfo(), and kaldi::nnet3::WriteVectorAsChar().
void WriteToken | ( | std::ostream & | os, |
bool | binary, | ||
const char * | token | ||
) |
The WriteToken functions are for writing nonempty sequences of non-space characters.
They are not for general strings.
Definition at line 134 of file io-funcs.cc.
References kaldi::CheckToken(), KALDI_ASSERT, and KALDI_ERR.
Referenced by LstmNonlinearityComponent::ConsolidateMemory(), kaldi::ReadBasicType(), kaldi::UnitTestIo(), kaldi::UnitTestIoNew(), kaldi::UnitTestIoPipe(), AccumAmDiagGmm::Write(), ScalarClusterable::Write(), AffineXformStats::Write(), CompressedAffineXformStats::Write(), MlltAccs::Write(), NnetExample::Write(), AmNnetSimple::Write(), RegressionTree::Write(), QuestionsForKey::Write(), CuBlockMatrix< Real >::Write(), RegtreeMllrDiagGmm::Write(), LogisticRegression::Write(), LinearVtln::Write(), Index::Write(), AmDiagGmm::Write(), NnetIo::Write(), FmpeOptions::Write(), GaussClusterable::Write(), DistributeComponent::Write(), BasisFmllrAccus::Write(), RegtreeFmllrDiagGmm::Write(), AccumFullGmm::Write(), LdaEstimate::Write(), NnetDiscriminativeSupervision::Write(), Sgmm2FmllrGlobalParams::Write(), ContextDependency::Write(), NnetChainSupervision::Write(), IoSpecification::Write(), NormalizeComponent::Write(), SparseVector< Real >::Write(), NnetDiscriminativeExample::Write(), BasisFmllrEstimate::Write(), AccumDiagGmm::Write(), NnetChainExample::Write(), Questions::Write(), RegtreeMllrDiagGmmAccs::Write(), FmllrSgmm2Accs::Write(), DiscriminativeSupervision::Write(), FullGmm::Write(), MleAmSgmm2Accs::Write(), HmmTopology::Write(), RefineClustersOptions::Write(), VectorClusterable::Write(), TransitionModel::Write(), Plda::Write(), CompressedMatrix::Write(), Nnet::Write(), DistributeComponentPrecomputedIndexes::Write(), PackedMatrix< float >::Write(), NnetOptimizeOptions::Write(), RestrictedAttentionComponent::Write(), ComputationRequest::Write(), Component::Write(), EventMap::Write(), GrammarFst::Write(), DiagGmm::Write(), ConvolutionComponent::Write(), DiscriminativeNnetExample::Write(), RegtreeFmllrDiagGmmAccs::Write(), ElementwiseProductComponent::Write(), RestrictedAttentionComponent::PrecomputedIndexes::Write(), SparseMatrix< float >::Write(), ConstantEventMap::Write(), OnlineGmmAdaptationState::Write(), BatchNormComponent::Write(), ConvolutionModel::Write(), AmSgmm2::Write(), StatisticsExtractionComponent::Write(), OnlineIvectorExtractorAdaptationState::Write(), TimeHeightConvolutionComponent::Write(), IvectorExtractor::Write(), TableEventMap::Write(), ConstArpaLm::Write(), OnlineCmvnState::Write(), TimeHeightConvolutionComponent::PrecomputedIndexes::Write(), StatisticsExtractionComponentPrecomputedIndexes::Write(), SplitEventMap::Write(), NnetComputation::MatrixInfo::Write(), NnetComputation::MatrixDebugInfo::Write(), NnetComputation::SubMatrixInfo::Write(), ConvolutionComputation::Write(), LstmNonlinearityComponent::Write(), NnetComputation::Command::Write(), VectorBase< float >::Write(), NonlinearComponent::Write(), OnlineIvectorEstimationStats::Write(), StatisticsPoolingComponent::Write(), ConvolutionComputationIo::Write(), MaxoutComponent::Write(), StatisticsPoolingComponentPrecomputedIndexes::Write(), NnetComputation::Write(), TdnnComponent::Write(), MaxpoolingComponent::Write(), IvectorExtractorStats::Write(), BackpropTruncationComponent::Write(), TdnnComponent::PrecomputedIndexes::Write(), PnormComponent::Write(), Sgmm2GauPost::Write(), BackpropTruncationComponentPrecomputedIndexes::Write(), RepeatedAffineComponent::Write(), ComputationCache::Write(), ConstantComponent::Write(), PowerComponent::Write(), ScaleComponent::Write(), DropoutMaskComponent::Write(), MatrixBase< float >::Write(), NaturalGradientAffineComponent::Write(), AffineComponent::Write(), GeneralDropoutComponent::Write(), LinearComponent::Write(), AffineComponentPreconditioned::Write(), GeneralDropoutComponentPrecomputedIndexes::Write(), AffineComponentPreconditionedOnline::Write(), SpecAugmentTimeMaskComponent::Write(), SpecAugmentTimeMaskComponentPrecomputedIndexes::Write(), SpliceComponent::Write(), SpliceMaxComponent::Write(), NoOpComponent::Write(), BlockAffineComponent::Write(), SumBlockComponent::Write(), BlockAffineComponentPreconditioned::Write(), SumGroupComponent::Write(), PermuteComponent::Write(), ClipGradientComponent::Write(), DctComponent::Write(), FixedLinearComponent::Write(), FixedAffineComponent::Write(), FixedScaleComponent::Write(), PerElementScaleComponent::Write(), FixedBiasComponent::Write(), DropoutComponent::Write(), PerElementOffsetComponent::Write(), AdditiveNoiseComponent::Write(), ConstantFunctionComponent::Write(), Convolutional1dComponent::Write(), NaturalGradientPerElementScaleComponent::Write(), ScaleAndOffsetComponent::Write(), CompositeComponent::Write(), Rbm::WriteAsNnet(), kaldi::WriteBuildTreeStats(), kaldi::nnet3::WriteCindexVector(), AveragePoolingComponent::WriteData(), MaxPoolingComponent::WriteData(), ParametricRelu::WriteData(), SimpleSentenceAveragingComponent::WriteData(), AffineTransform::WriteData(), RecurrentComponent::WriteData(), LinearTransform::WriteData(), ParallelComponent::WriteData(), LstmProjected::WriteData(), FramePoolingComponent::WriteData(), MultiBasisComponent::WriteData(), ConvolutionalComponent::WriteData(), BlstmProjected::WriteData(), Rbm::WriteData(), Dropout::WriteData(), AddShift::WriteData(), Rescale::WriteData(), kaldi::WriteEventType(), kaldi::nnet3::WriteIndexVector(), kaldi::WriteToken(), and UpdatableComponent::WriteUpdatableCommon().
void WriteToken | ( | std::ostream & | os, |
bool | binary, | ||
const std::string & | token | ||
) |
Definition at line 150 of file io-funcs.cc.
References kaldi::WriteToken().