Permalink
Browse files

Accept numpy scalars in shapes.

  • Loading branch information...
1 parent 89c2d55 commit 393bb7c2fed7dbe2ecc21efb5eca8c20de94b57a @inducer committed Oct 7, 2012
Showing with 11 additions and 0 deletions.
  1. +2 −0 pycuda/gpuarray.py
  2. +9 −0 test/test_gpuarray.py
View
@@ -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
@@ -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)

0 comments on commit 393bb7c

Please sign in to comment.