MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / gaussianKernelTestCPP

Function gaussianKernelTestCPP

test/gaussiankernel.cpp:115–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113using af::gaussianKernel;
114
115void gaussianKernelTestCPP(string pFileName, double sigma) {
116 vector<dim4> numDims;
117 vector<vector<int>> in;
118 vector<vector<float>> tests;
119
120 readTestsFromFile<int, float>(pFileName, numDims, in, tests);
121
122 vector<int> input(in[0].begin(), in[0].end());
123
124 array out = gaussianKernel(input[0], input[1], sigma, sigma);
125
126 dim_t outElems = out.elements();
127 float *outData = new float[outElems];
128 out.host(outData);
129
130 vector<float> currGoldBar(tests[0].begin(), tests[0].end());
131 size_t nElems = currGoldBar.size();
132
133 ASSERT_EQ(outElems, (dim_t)nElems);
134
135 for (size_t elIter = 0; elIter < nElems; ++elIter) {
136 ASSERT_NEAR(currGoldBar[elIter], outData[elIter], 1.0e-3)
137 << "at: " << elIter << endl;
138 }
139
140 delete[] outData;
141}
142
143TEST(GaussianKernel, Small1D_CPP) {
144 gaussianKernelTestCPP(string(TEST_DIR "/gaussian/gauss1_7.test"), 0.0);

Callers 1

TESTFunction · 0.85

Calls 3

hostMethod · 0.80
gaussianKernelFunction · 0.50
elementsMethod · 0.45

Tested by

no test coverage detected