Skip to content
Snippets Groups Projects
Commit 494ed7f4 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Fix zeros() on vector array. (Reported by Sebastian Nowozin)

parent 901ce021
No related branches found
No related tags found
No related merge requests found
......@@ -680,7 +680,8 @@ def zeros(*args, **kwargs):
def _zeros(queue, shape, dtype, order="C", allocator=None):
result = Array(queue, shape, dtype,
order=order, allocator=allocator)
result.fill(0)
zero = np.zeros((), dtype)
result.fill(zero)
return result
if isinstance(args[0], cl.Context):
......@@ -703,7 +704,8 @@ def empty_like(ary):
def zeros_like(ary):
result = empty_like(ary)
result.fill(0)
zero = np.zeros((), ary.dtype)
result.fill(zero)
return result
......
......@@ -615,6 +615,8 @@ def test_vector_fill(ctx_getter):
a = a_gpu.get()
assert a.dtype is cl_array.vec.float4
a_gpu = cl_array.zeros(queue, 100, dtype=cl_array.vec.float4)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment