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

Function TEST

tensorflow/core/kernels/mfcc_dct_test.cc:25–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23namespace tensorflow {
24
25TEST(MfccDctTest, AgreesWithMatlab) {
26 // This test verifies the DCT against MATLAB's dct function.
27 MfccDct dct;
28 std::vector<double> input = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0};
29 const int kCoefficientCount = 6;
30 ASSERT_TRUE(dct.Initialize(input.size(), kCoefficientCount));
31 std::vector<double> output;
32 dct.Compute(input, &output);
33 // Note, the matlab dct function divides the first coefficient by
34 // sqrt(2), whereas we don't, so we multiply the first element of
35 // the matlab result by sqrt(2) to get the expected values below.
36 std::vector<double> expected = {12.1243556530, -4.1625617959, 0.0,
37 -0.4082482905, 0.0, -0.0800788912};
38 ASSERT_EQ(output.size(), kCoefficientCount);
39 for (int i = 0; i < kCoefficientCount; ++i) {
40 EXPECT_NEAR(output[i], expected[i], 1e-10);
41 }
42}
43
44TEST(MfccDctTest, InitializeFailsOnInvalidInput) {
45 MfccDct dct1;

Callers

nothing calls this directly

Calls 3

InitializeMethod · 0.45
sizeMethod · 0.45
ComputeMethod · 0.45

Tested by

no test coverage detected