-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot provide custom tensordot
method
#101
Comments
Maybe you could expand a bit on what you have tried? The equation you give as an example cannot be framed as a simple tensordot, since the index |
Sure. The docs seem to imply that if you provide a
In practice I love the idea that opt-einsum could be used with general operators, but it seems like maybe the docs should be updated to make it clear that it requires a full einsum implementation below the hood? |
The main role of With regard to point 1, does your backend provide an
There are simple cases (such as here where |
I see, I guess I got tripped up by this statement: "In fact, any library that provides a tensordot() and transpose() implementation can perform most normal contractions." Keeping axes around felt pretty normal to me (for instance any sort of batching). Writing an einsum implementation is really hard, it requires a parser and all sort of special cases. I like the idea that opt-einsum could be used as a front-end for the non-standard contractions I want to do. Any idea for the true minimal set of functions a backend could implement such that opt-einsum could be used as a front-end? |
This sounds a bit like we need a
We should only need einsum, tensordot, and transpose for full functionality. Another good time to look into NEP18. |
@dgasmith I think the issue is just the type of contraction requiring a non-existent
Yes I guess 'normal' is pretty subjective! I was coming from the background of physics and einstein notation when I wrote that I suspect.
I think
But once they start getting mixed together, e.g. ( |
I would lean with @jcmgray that this functionality could be complex to implement. At the moment, you can hack this with the following: import opt_einsum as oe
oe.backends.dispatch._cached_funcs["tensordor", "numpy"] = custom_func Happy to take a PR which is well documented with edge cases. |
As far as I can tell there is no way to provide a custom
tensordot
method. I tried pretty hard, but the code path seems to fail on examples likecontract("abc,ab-> ac")
.The text was updated successfully, but these errors were encountered: