| 913 | |
| 914 | template<typename T> |
| 915 | void convolve2stridedTest(string pTestFile, dim4 stride, dim4 padding, |
| 916 | dim4 dilation) { |
| 917 | SUPPORTED_TYPE_CHECK(T); |
| 918 | |
| 919 | vector<dim4> numDims; |
| 920 | vector<vector<T>> in; |
| 921 | vector<vector<T>> tests; |
| 922 | |
| 923 | readTests<T, T, float>(pTestFile, numDims, in, tests); |
| 924 | |
| 925 | dim4 sDims = numDims[0]; |
| 926 | dim4 fDims = numDims[1]; |
| 927 | af_array signal = 0; |
| 928 | af_array filter = 0; |
| 929 | af_array convolved = 0; |
| 930 | |
| 931 | ASSERT_SUCCESS(af_create_array(&signal, &(in[0].front()), sDims.ndims(), |
| 932 | sDims.get(), |
| 933 | (af_dtype)dtype_traits<T>::af_type)); |
| 934 | ASSERT_SUCCESS(af_create_array(&filter, &(in[1].front()), fDims.ndims(), |
| 935 | fDims.get(), |
| 936 | (af_dtype)dtype_traits<T>::af_type)); |
| 937 | |
| 938 | ASSERT_SUCCESS(af_convolve2_nn(&convolved, signal, filter, stride.ndims(), |
| 939 | stride.get(), padding.ndims(), padding.get(), |
| 940 | dilation.ndims(), dilation.get())); |
| 941 | |
| 942 | vector<T> &currGoldBar = tests[0]; |
| 943 | |
| 944 | dim_t expectedDim0 = |
| 945 | 1 + (sDims[0] + 2 * padding[0] - (((fDims[0] - 1) * dilation[0]) + 1)) / |
| 946 | stride[0]; |
| 947 | dim_t expectedDim1 = |
| 948 | 1 + (sDims[1] + 2 * padding[1] - (((fDims[1] - 1) * dilation[1]) + 1)) / |
| 949 | stride[1]; |
| 950 | |
| 951 | auto gdim = dim4(expectedDim0, expectedDim1, fDims[3], sDims[3]); |
| 952 | ASSERT_VEC_ARRAY_NEAR(currGoldBar, gdim, convolved, tolerance<T>()); |
| 953 | |
| 954 | ASSERT_SUCCESS(af_release_array(convolved)); |
| 955 | ASSERT_SUCCESS(af_release_array(signal)); |
| 956 | ASSERT_SUCCESS(af_release_array(filter)); |
| 957 | } |
| 958 | |
| 959 | template<typename T> |
| 960 | void convolve2GradientTest(string pTestFile, dim4 stride, dim4 padding, |
nothing calls this directly
no test coverage detected