Closed danielkelshaw closed 1 year ago
Update: I was using the most recently available version from PyPI
, i.e: opt_einsum=3.3.0
. When I install from source using the latest version on the repository this issue is resolved.
While this is not an issue yet, it will become one upon the next release. It's difficult to type contract
well since each Array-type will have unique properties. Typing the interface is difficult as well since there are multiple input pathways and we generally coerce types.
I don't have a great solution here at the moment with Python's current typing system. An idea is that we could try to build a Union
on the fly based off imported libraries.
Hi, first off I just want to thank you for developing and maintaining a great package!
I notice that the return type of
oe.contract
isAny
: https://github.com/dgasmith/opt_einsum/blob/1a984b7b75f3e532e7129f6aa13f7ddc3da66e10/opt_einsum/typing.py#L8This is causing some small annoyances with my
lsp
when I try to multiply the result of a contraction with afloat
. For instance, I get the error:Pyright: Operator "*" not supported for types "float" and "Unknown | Any | ContractExpression | tuple[Unknown, Unknown]"
Are you aware of any way to get around this or am I stuck with this error if I continue to use
opt_einsum
?To clarify: the code runs fine -- just getting highlighted as an error in my IDE.