diff --git a/quimb/tensor/contraction.py b/quimb/tensor/contraction.py index b5d6c372..66e4f000 100644 --- a/quimb/tensor/contraction.py +++ b/quimb/tensor/contraction.py @@ -326,5 +326,11 @@ def array_contract_pathinfo(*args, **kwargs): path = tree.get_path() eq = tree.get_eq() + if (eq == "->") and (len(path) == 0): + # XXX: opt_einsum does not support empty paths + # https://github.com/jcmgray/quimb/issues/231 + # https://github.com/dgasmith/opt_einsum/pull/229 + path = ((0,),) + return oe.contract_path(eq, *shapes, shapes=True, optimize=path)[1]