Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Accept numpy scalars in shapes.

  • Loading branch information...
commit 393bb7c2fed7dbe2ecc21efb5eca8c20de94b57a 1 parent 89c2d55
@inducer authored
Showing with 11 additions and 0 deletions.
  1. +2 −0  pycuda/gpuarray.py
  2. +9 −0 test/test_gpuarray.py
View
2  pycuda/gpuarray.py
@@ -162,6 +162,8 @@ def __init__(self, shape, dtype, allocator=drv.mem_alloc,
s = shape
shape = (shape,)
+ s = np.asscalar(s)
+
if strides is None:
if order == "F":
strides = _f_contiguous_strides(
View
9 test/test_gpuarray.py
@@ -50,6 +50,15 @@ def test_pow_number(self):
+
+ @mark_cuda_test
+ def test_numpy_integer_shape(self):
+ gpuarray.empty(np.int32(17), np.float32)
+ gpuarray.empty((np.int32(17), np.int32(17)), np.float32)
+
+
+
+
@mark_cuda_test
def test_abs(self):
a = -gpuarray.arange(111, dtype=np.float32)
Please sign in to comment.
Something went wrong with that request. Please try again.