FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

TEST: Adding GFOR tests for convolve · arrayfire/arrayfire@2631d68 · GitHub

Repository navigation

Commit 2631d68

Browse files
committed
TEST: Adding GFOR tests for convolve
1 parent 8c2156a commit 2631d68

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

‎test/convolve.cpp‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,3 +614,56 @@ TEST(Convolve, Docs_Unified_Wrapper)
614614
// 1.0000 1.0000 1.0000 0.5000
615615
//![ex_image_convolve_3d]
616616
}
617+
618+
using namespace af;
619+
620+
TEST(GFOR, convolve2_MO)
621+
{
622+
array A = randu(5, 5, 3);
623+
array B = randu(5, 5, 3);
624+
array K = randu(3, 3);
625+
626+
gfor(seq ii, 3) {
627+
B(span, span, ii) = convolve2(A(span, span, ii), K);
628+
}
629+
630+
for (int ii = 0; ii < 3; ii++) {
631+
array c_ii = convolve2(A(span, span, ii), K);
632+
array b_ii = B(span, span, ii);
633+
ASSERT_EQ(max<double>(abs(c_ii - b_ii)) < 1E-5, true);
634+
}
635+
}
636+
637+
TEST(GFOR, convolve2_1M)
638+
{
639+
array A = randu(5, 5);
640+
array B = randu(5, 5, 3);
641+
array K = randu(3, 3, 3);
642+
643+
gfor(seq ii, 3) {
644+
B(span, span, ii) = convolve2(A, K(span, span, ii));
645+
}
646+
647+
for (int ii = 0; ii < 3; ii++) {
648+
array c_ii = convolve2(A, K(span, span, ii));
649+
array b_ii = B(span, span, ii);
650+
ASSERT_EQ(max<double>(abs(c_ii - b_ii)) < 1E-5, true);
651+
}
652+
}
653+
654+
TEST(GFOR, convolve2_MM)
655+
{
656+
array A = randu(5, 5, 3);
657+
array B = randu(5, 5, 3);
658+
array K = randu(3, 3, 3);
659+
660+
gfor(seq ii, 3) {
661+
B(span, span, ii) = convolve2(A(span, span, ii), K(span, span, ii));
662+
}
663+
664+
for (int ii = 0; ii < 3; ii++) {
665+
array c_ii = convolve2(A(span, span, ii), K(span, span, ii));
666+
array b_ii = B(span, span, ii);
667+
ASSERT_EQ(max<double>(abs(c_ii - b_ii)) < 1E-5, true);
668+
}
669+
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL