Skip to content

Commit 3f57b8b

Browse files
mitkotakinducer
authored andcommitted
added check for not checking strides of 0-sized arrays
resolved flake8 Resolved typo resolved typo Fixed spaces Fixed some more spaces added comment improved comment resolved inducer comment on format
1 parent d1157d1 commit 3f57b8b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arraycontext/container/traversal.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,12 @@ def _unflatten(template_subary: ArrayOrContainerT) -> ArrayOrContainerT:
779779
# {{{ check strides
780780

781781
if strict and hasattr(template_subary, "strides"):
782-
if template_subary.strides != subary.strides:
782+
# Checking strides for 0 sized arrays is ill-defined
783+
# since they cannot be indexed
784+
if (
785+
template_subary.strides != subary.strides
786+
and template_subary.size != 0
787+
):
783788
raise ValueError(
784789
f"strides do not match template: got {subary.strides}, "
785790
f"expected {template_subary.strides}")

0 commit comments

Comments
 (0)