[arrayfire] 158/408: Extended support for interleaved convolution

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:11:45 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.

commit 16d8e27e3557923209318ead7b1e1923fb8864c1
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Mon Jul 20 09:28:51 2015 -0400

    Extended support for interleaved convolution
---
 src/api/c/convolve.cpp    |  2 +-
 src/api/c/fftconvolve.cpp |  2 +-
 test/fftconvolve.cpp      | 13 +++++++++++++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/api/c/convolve.cpp b/src/api/c/convolve.cpp
index 2886e9f..694c2cc 100644
--- a/src/api/c/convolve.cpp
+++ b/src/api/c/convolve.cpp
@@ -52,7 +52,7 @@ ConvolveBatchKind identifyBatchKind(const dim4 &sDims, const dim4 &fDims)
         bool isInterleaved = true;
         for (dim_t i=baseDim; i<4; i++) {
             doesDimensionsMatch &= (sDims[i] == fDims[i]);
-            isInterleaved &= (sDims[i] == 1 || fDims[i] == 1);
+            isInterleaved &= (sDims[i] == 1 || fDims[i] == 1 || sDims[i] == fDims[i]);
         }
         if (doesDimensionsMatch) return CONVOLVE_BATCH_SAME;
         return (isInterleaved ? CONVOLVE_BATCH_DIFF : CONVOLVE_BATCH_UNSUPPORTED);
diff --git a/src/api/c/fftconvolve.cpp b/src/api/c/fftconvolve.cpp
index d359119..4405223 100644
--- a/src/api/c/fftconvolve.cpp
+++ b/src/api/c/fftconvolve.cpp
@@ -112,7 +112,7 @@ ConvolveBatchKind identifyBatchKind(const dim4 &sDims, const dim4 &fDims)
         bool isInterleaved = true;
         for (dim_t i=baseDim; i<4; i++) {
             doesDimensionsMatch &= (sDims[i] == fDims[i]);
-            isInterleaved &= (sDims[i] == 1 || fDims[i] == 1);
+            isInterleaved &= (sDims[i] == 1 || fDims[i] == 1 || sDims[i] == fDims[i]);
         }
         if (doesDimensionsMatch) return CONVOLVE_BATCH_SAME;
         return (isInterleaved ? CONVOLVE_BATCH_DIFF : CONVOLVE_BATCH_UNSUPPORTED);
diff --git a/test/fftconvolve.cpp b/test/fftconvolve.cpp
index ff961b0..eb0e618 100644
--- a/test/fftconvolve.cpp
+++ b/test/fftconvolve.cpp
@@ -677,3 +677,16 @@ TEST(FFTConvolve2, Interleaved)
         ASSERT_EQ(max<double>(abs(c_ii - d)) < 1E-5, true);
     }
 }
+
+TEST(FFTConvolve2, Interleaved2)
+{
+    array a = randu(100, 100, 2);
+    array b = randu(5, 5, 2, 3);
+    array c = fftConvolve2(a, b);
+
+    for (int ii = 0; ii < 3; ii++) {
+        array c_ii = c(span, span, span, ii);
+        array d = fftConvolve2(a, b(span, span, span, ii));
+        ASSERT_EQ(max<double>(abs(c_ii - d)) < 1E-5, true);
+    }
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list