From 3f57b8beab187243a02b82593f8160f2418df261 Mon Sep 17 00:00:00 2001 From: Mit Kotak <mitkotak0305@gmail.com> Date: Sat, 18 Jun 2022 19:08:05 -0500 Subject: [PATCH] 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 --- arraycontext/container/traversal.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arraycontext/container/traversal.py b/arraycontext/container/traversal.py index 84bd546..2911340 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}") -- GitLab