From a5014f8f38bb78e795d1732142e72decfb2305f8 Mon Sep 17 00:00:00 2001 From: holl- Date: Fri, 24 Nov 2023 13:46:37 +0100 Subject: [PATCH] Fix Sliceable instance check --- phiml/math/magic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phiml/math/magic.py b/phiml/math/magic.py index 40132340..5580216e 100644 --- a/phiml/math/magic.py +++ b/phiml/math/magic.py @@ -78,7 +78,7 @@ class _SliceableType(type): def __instancecheck__(self, instance): if isinstance(instance, str): return False - return isinstance(instance, Shaped) and hasattr(instance, '__getitem__') + return isinstance(instance, Shaped) and (hasattr(instance, '__getitem__') or isinstance(instance, PhiTreeNode)) def __subclasscheck__(self, subclass): if subclass == str: