[arrayfire] 58/248: Fix sizes for approx batch tests

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Nov 17 15:53:55 UTC 2015


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

ghisvail-guest pushed a commit to branch dfsg-clean
in repository arrayfire.

commit 1b5268161b8b495d53304660ebcb51f9c26e4f87
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Fri Sep 4 13:55:06 2015 -0400

    Fix sizes for approx batch tests
---
 test/approx1.cpp | 14 +++++++-------
 test/approx2.cpp | 16 ++++++++--------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/test/approx1.cpp b/test/approx1.cpp
index 59101b2..01bee13 100644
--- a/test/approx1.cpp
+++ b/test/approx1.cpp
@@ -239,17 +239,17 @@ TEST(Approx1, CPPNearestBatch)
     if (noDoubleTests<float>()) return;
 
     af::array input = af::randu(600, 10);
-    af::array pos   = af::randu(100, 10);
+    af::array pos   = input.dims(0) * af::randu(100, 10);
 
     af::array outBatch = af::approx1(input, pos, AF_INTERP_NEAREST);
 
     af::array outSerial(pos.dims());
-    for(int i = 0; i < pos.dims()[1]; i++) {
+    for(int i = 0; i < pos.dims(1); i++) {
         outSerial(af::span, i) = af::approx1(input(af::span, i), pos(af::span, i), AF_INTERP_NEAREST);
     }
 
     af::array outGFOR(pos.dims());
-    gfor(af::seq i, 10) {
+    gfor(af::seq i, pos.dims(1)) {
         outGFOR(af::span, i) = af::approx1(input(af::span, i), pos(af::span, i), AF_INTERP_NEAREST);
     }
 
@@ -261,18 +261,18 @@ TEST(Approx1, CPPLinearBatch)
 {
     if (noDoubleTests<float>()) return;
 
-    af::array input = af::iota(af::dim4(10, 10));
-    af::array pos   = af::randu(10, 10);
+    af::array input = af::iota(af::dim4(10000, 20), c32);
+    af::array pos   = input.dims(0) * af::randu(562500, 20);
 
     af::array outBatch = af::approx1(input, pos, AF_INTERP_LINEAR);
 
     af::array outSerial(pos.dims());
-    for(int i = 0; i < pos.dims()[1]; i++) {
+    for(int i = 0; i < pos.dims(1); i++) {
         outSerial(af::span, i) = af::approx1(input(af::span, i), pos(af::span, i), AF_INTERP_LINEAR);
     }
 
     af::array outGFOR(pos.dims());
-    gfor(af::seq i, 10) {
+    gfor(af::seq i, pos.dims(1)) {
         outGFOR(af::span, i) = af::approx1(input(af::span, i), pos(af::span, i), AF_INTERP_LINEAR);
     }
 
diff --git a/test/approx2.cpp b/test/approx2.cpp
index 3cfd3ea..f1a1acc 100644
--- a/test/approx2.cpp
+++ b/test/approx2.cpp
@@ -254,19 +254,19 @@ TEST(Approx2, CPPNearestBatch)
     if (noDoubleTests<float>()) return;
 
     af::array input = af::randu(200, 100, 10);
-    af::array pos   = af::randu(100, 100, 10);
-    af::array qos   = af::randu(100, 100, 10);
+    af::array pos   = input.dims(0) * af::randu(100, 100, 10);
+    af::array qos   = input.dims(1) * af::randu(100, 100, 10);
 
     af::array outBatch = af::approx2(input, pos, qos, AF_INTERP_NEAREST);
 
     af::array outSerial(pos.dims());
-    for(int i = 0; i < pos.dims()[2]; i++) {
+    for(int i = 0; i < pos.dims(2); i++) {
         outSerial(af::span, af::span, i) = af::approx2(input(af::span, af::span, i),
             pos(af::span, af::span, i), qos(af::span, af::span, i), AF_INTERP_NEAREST);
     }
 
     af::array outGFOR(pos.dims());
-    gfor(af::seq i, 10) {
+    gfor(af::seq i, pos.dims(2)) {
         outGFOR(af::span, af::span, i) = af::approx2(input(af::span, af::span, i),
             pos(af::span, af::span, i), qos(af::span, af::span, i), AF_INTERP_NEAREST);
     }
@@ -280,19 +280,19 @@ TEST(Approx2, CPPLinearBatch)
     if (noDoubleTests<float>()) return;
 
     af::array input = af::randu(200, 100, 10);
-    af::array pos   = af::randu(100, 100, 10);
-    af::array qos   = af::randu(100, 100, 10);
+    af::array pos   = input.dims(0) * af::randu(100, 100, 10);
+    af::array qos   = input.dims(1) * af::randu(100, 100, 10);
 
     af::array outBatch = af::approx2(input, pos, qos, AF_INTERP_LINEAR);
 
     af::array outSerial(pos.dims());
-    for(int i = 0; i < pos.dims()[2]; i++) {
+    for(int i = 0; i < pos.dims(2); i++) {
         outSerial(af::span, af::span, i) = af::approx2(input(af::span, af::span, i),
             pos(af::span, af::span, i), qos(af::span, af::span, i), AF_INTERP_LINEAR);
     }
 
     af::array outGFOR(pos.dims());
-    gfor(af::seq i, 10) {
+    gfor(af::seq i, pos.dims(2)) {
         outGFOR(af::span, af::span, i) = af::approx2(input(af::span, af::span, i),
             pos(af::span, af::span, i), qos(af::span, af::span, i), AF_INTERP_LINEAR);
     }

-- 
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