Skip to content

Commit

Permalink
more detailed error when backend is missing a function e.g. einsum
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmgray committed May 12, 2020
1 parent 7756811 commit 7ee19fa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion opt_einsum/backends/dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ def _import_func(func, backend, default=None):
lib = importlib.import_module(_aliases.get(backend, backend))
return getattr(lib, func) if default is None else getattr(lib, func, default)
except AttributeError:
raise AttributeError("{} doesn't seem to provide the function {}".format(backend, func))
error_msg = ("{} doesn't seem to provide the function {} - see "
"https://optimized-einsum.readthedocs.io/en/latest/backends.html "
"for details on which functions are required for which contractions.")
raise AttributeError(error_msg.format(backend, func))


# manually cache functions as python2 doesn't support functools.lru_cache
Expand Down

0 comments on commit 7ee19fa

Please sign in to comment.