MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/core/kernels/mfcc_test.cc:25–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23namespace tensorflow {
24
25TEST(MfccTest, AgreesWithPythonGoldenValues) {
26 Mfcc mfcc;
27 std::vector<double> input;
28 const int kSampleCount = 513;
29 input.reserve(kSampleCount);
30 for (int i = 0; i < kSampleCount; ++i) {
31 input.push_back(i + 1);
32 }
33
34 ASSERT_TRUE(mfcc.Initialize(input.size(), 22050 /*sample rate*/));
35
36 std::vector<double> output;
37 mfcc.Compute(input, &output);
38
39 std::vector<double> expected = {
40 29.13970072, -6.41568601, -0.61903012, -0.96778652, -0.26819878,
41 -0.40907028, -0.15614748, -0.23203119, -0.10481487, -0.1543029,
42 -0.0769791, -0.10806114, -0.06047613};
43
44 ASSERT_EQ(expected.size(), output.size());
45 for (int i = 0; i < output.size(); ++i) {
46 EXPECT_NEAR(output[i], expected[i], 1e-04);
47 }
48}
49
50TEST(MfccTest, AvoidsNansWithZeroInput) {
51 Mfcc mfcc;

Callers

nothing calls this directly

Calls 12

isnanClass · 0.85
reserveMethod · 0.45
push_backMethod · 0.45
InitializeMethod · 0.45
sizeMethod · 0.45
ComputeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected