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

Function dotTest

test/dot.cpp:60–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58
59template<typename T>
60void dotTest(string pTestFile, const int resultIdx,
61 const af_mat_prop optLhs = AF_MAT_NONE,
62 const af_mat_prop optRhs = AF_MAT_NONE) {
63 SUPPORTED_TYPE_CHECK(T);
64
65 vector<dim4> numDims;
66 vector<vector<T>> in;
67 vector<vector<T>> tests;
68
69 readTests<T, T, T>(pTestFile, numDims, in, tests);
70
71 dim4 aDims = numDims[0];
72 dim4 bDims = numDims[1];
73
74 af_array a = 0;
75 af_array b = 0;
76 af_array out = 0;
77
78 ASSERT_SUCCESS(af_create_array(&a, &(in[0].front()), aDims.ndims(),
79 aDims.get(),
80 (af_dtype)dtype_traits<T>::af_type));
81 ASSERT_SUCCESS(af_create_array(&b, &(in[1].front()), bDims.ndims(),
82 bDims.get(),
83 (af_dtype)dtype_traits<T>::af_type));
84
85 ASSERT_SUCCESS(af_dot(&out, a, b, optLhs, optRhs));
86
87 vector<T> goldData = tests[resultIdx];
88 size_t nElems = goldData.size();
89
90 ASSERT_VEC_ARRAY_NEAR(goldData, dim4(nElems), out, 0.03);
91
92 ASSERT_SUCCESS(af_release_array(a));
93 ASSERT_SUCCESS(af_release_array(b));
94 ASSERT_SUCCESS(af_release_array(out));
95}
96
97template<typename T>
98void compare(double rval, double /*ival*/, T gold) {

Callers

nothing calls this directly

Calls 6

af_create_arrayFunction · 0.50
af_dotFunction · 0.50
dim4Class · 0.50
af_release_arrayFunction · 0.50
ndimsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected