[python-dtcwt] 172/497: opencl.lowlevel: let to_array take non-CL arrays as a NOP

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:06:01 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 python-dtcwt.

commit 8651d7b9e9523ca3fcb8b69e7f7624c541a989ed
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date:   Sat Nov 9 13:55:37 2013 +0000

    opencl.lowlevel: let to_array take non-CL arrays as a NOP
    
    If to_array() is passed a non-CL array, it returns it straight away.
---
 dtcwt/opencl/lowlevel.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dtcwt/opencl/lowlevel.py b/dtcwt/opencl/lowlevel.py
index 047255a..e308d68 100644
--- a/dtcwt/opencl/lowlevel.py
+++ b/dtcwt/opencl/lowlevel.py
@@ -182,6 +182,9 @@ def to_device(X, queue=None):
     return cl_array.to_device(to_queue(queue), np.array(X, dtype=np.float32, order='C'))
 
 def to_array(a, queue=None):
+    # Support passing non-CL arrays in and getting them straight back out
+    if not isinstance(a, cl_array.Array):
+        return a
     queue = queue or a.queue or to_queue(queue)
     rv = np.empty(a.shape, a.dtype)
     cl.enqueue_copy(queue, rv, a.data).wait()

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



More information about the debian-science-commits mailing list