[arrayfire] 10/26: BUGFIX for gradient when single element is in new block
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Jul 7 13:59:23 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository arrayfire.
commit a3de665d6c2d08a25a2b049433a93cd6ce0c58c9
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date: Sat Jun 20 12:36:33 2015 -0400
BUGFIX for gradient when single element is in new block
---
src/backend/cuda/kernel/gradient.hpp | 4 ++--
src/backend/opencl/kernel/gradient.cl | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/backend/cuda/kernel/gradient.hpp b/src/backend/cuda/kernel/gradient.hpp
index 1712d6f..6d44534 100644
--- a/src/backend/cuda/kernel/gradient.hpp
+++ b/src/backend/cuda/kernel/gradient.hpp
@@ -72,14 +72,14 @@ namespace cuda
// Y-1
sidx(-1, threadIdx.x) = (cond || idy == 0) ?
sidx(0, threadIdx.x) : in.ptr[iIdx - in.strides[1]];
- sidx(ymax, threadIdx.x) = (cond || idy + ymax >= in.dims[1] - 1) ?
+ sidx(ymax, threadIdx.x) = (cond || (idy + ymax) >= in.dims[1]) ?
sidx(ymax - 1, threadIdx.x) : in.ptr[iIdx + ymax * in.strides[1]];
}
// Rows
if(threadIdx.x == 0) {
sidx(threadIdx.y, -1) = (cond || idx == 0) ?
sidx(threadIdx.y, 0) : in.ptr[iIdx - 1];
- sidx(threadIdx.y, xmax) = (cond || idx + xmax >= in.dims[0] - 1) ?
+ sidx(threadIdx.y, xmax) = (cond || (idx + xmax) >= in.dims[0]) ?
sidx(threadIdx.y, xmax - 1) : in.ptr[iIdx + xmax];
}
diff --git a/src/backend/opencl/kernel/gradient.cl b/src/backend/opencl/kernel/gradient.cl
index cb0ff68..b55d9c7 100644
--- a/src/backend/opencl/kernel/gradient.cl
+++ b/src/backend/opencl/kernel/gradient.cl
@@ -80,14 +80,14 @@ void gradient_kernel(__global T *d_grad0, const KParam grad0,
// Y-1
sidx(-1, tx) = (cond || idy == 0) ?
sidx(0, tx) : d_in[iIdx - in.strides[1]];
- sidx(ymax, tx) = (cond || idy + ymax >= in.dims[1] - 1) ?
+ sidx(ymax, tx) = (cond || (idy + ymax) >= in.dims[1]) ?
sidx(ymax - 1, tx) : d_in[iIdx + ymax * in.strides[1]];
}
// Rows
if(tx == 0) {
sidx(ty, -1) = (cond || idx == 0) ?
sidx(ty, 0) : d_in[iIdx - 1];
- sidx(ty, xmax) = (cond || idx + xmax >= in.dims[0] - 1) ?
+ sidx(ty, xmax) = (cond || (idx + xmax) >= in.dims[0]) ?
sidx(ty, xmax - 1) : d_in[iIdx + xmax];
}
--
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