diff --git a/arraycontext/container/traversal.py b/arraycontext/container/traversal.py index 84bd546732b05663653f3247e81ccabda8cd8f03..291134077bbdb6928265b110848788f684ae4725 100644 --- a/arraycontext/container/traversal.py +++ b/arraycontext/container/traversal.py @@ -779,7 +779,12 @@ def unflatten( # {{{ check strides if strict and hasattr(template_subary, "strides"): - if template_subary.strides != subary.strides: + # Checking strides for 0 sized arrays is ill-defined + # since they cannot be indexed + if ( + template_subary.strides != subary.strides + and template_subary.size != 0 + ): raise ValueError( f"strides do not match template: got {subary.strides}, " f"expected {template_subary.strides}")