46 right_context, input_dim, output_dim,
48 bool binary = (
RandInt(0, 1) == 0);
49 std::ostringstream os;
54 std::istringstream is(os.str());
55 eg_copy.
Read(is, binary);
56 std::ostringstream os2;
57 eg_copy.
Write(os2, binary);
77 std::vector<NnetExample> egs_to_be_merged(num_egs);
78 for (
int32 i = 0;
i < num_egs;
i++) {
83 right_context, input_dim, output_dim,
84 RandInt(0, 1) == 0 ? 0 : ivector_dim,
86 KALDI_LOG <<
i <<
"'th example to be merged is: ";
87 eg.
Write(std::cerr,
false);
88 egs_to_be_merged[
i].Swap(&eg);
91 bool compress = (
RandInt(0, 1) == 0);
94 eg_merged.
Write(std::cerr,
false);
104 using namespace kaldi;
110 KALDI_LOG <<
"Nnet-example tests succeeded.";
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 GenerateSimpleNnetTrainingExample(int32 num_supervised_frames, int32 left_context, int32 right_context, int32 output_dim, int32 input_dim, int32 ivector_dim, NnetExample *example)
Low-level function that generates an nnet training example.
void UnitTestNnetMergeExamples()
This file contains various routines that are useful in test code.
This file contains utilities for analyzing and checking computations, which are used in the optimizat...
void UnitTestNnetExample()
void Write(std::ostream &os, bool binary) const
bool ExampleApproxEqual(const NnetExample &eg1, const NnetExample &eg2, BaseFloat delta)
Returns true if the examples are approximately equal (only intended to be used in testing)...
#define KALDI_ASSERT(cond)
void Read(std::istream &is, bool binary)
int32 RandInt(int32 min_val, int32 max_val, struct RandomState *state)
void MergeExamples(const std::vector< NnetExample > &src, bool compress, NnetExample *merged_eg)
Merge a set of input examples into a single example (typically the size of "src" will be the minibatc...