Skip to content
Snippets Groups Projects
Unverified Commit 3df0533e authored by Kaushik Kulkarni's avatar Kaushik Kulkarni Committed by GitHub
Browse files

[PytatoPyOpenCLArrayContext] Do not evaluate array expressions for 0-sized arrays (#69)


* do not evaluate array expressions for 0-sized arrays

* Use empty for empty arrays

Co-authored-by: default avatarAndreas Klöckner <inform@tiker.net>
parent 112ada65
No related branches found
No related tags found
No related merge requests found
Pipeline #196578 passed
...@@ -123,6 +123,16 @@ class PytatoPyOpenCLArrayContext(ArrayContext): ...@@ -123,6 +123,16 @@ class PytatoPyOpenCLArrayContext(ArrayContext):
raise TypeError("PytatoPyOpenCLArrayContext.freeze invoked with " raise TypeError("PytatoPyOpenCLArrayContext.freeze invoked with "
f"non-pytato array of type '{type(array)}'") f"non-pytato array of type '{type(array)}'")
# {{{ early exit for 0-sized arrays
if array.size == 0:
return cla.empty(self.queue.context,
shape=array.shape,
dtype=array.dtype,
allocator=self.allocator)
# }}}
from arraycontext.impl.pytato.utils import _normalize_pt_expr from arraycontext.impl.pytato.utils import _normalize_pt_expr
normalized_expr, bound_arguments = _normalize_pt_expr(array) normalized_expr, bound_arguments = _normalize_pt_expr(array)
......
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