-
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
Remove NumPy as a hard dependency #204
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM so far! Do you understand the test failures, is that just an env thing?
I didn't get to every test yet. I'll hack a bit this weekend. |
@janeyx99 Is this still of interest to Torch? I think we're relatively close on removing that last of the NumPy dependancies. |
Yes! Removing the last dependencies would be awesome! |
Apologies- I started a new job. This is in my mind and I hope to hack a little tomorrow night! |
@janeyx99 I'm looking to push another release shortly, is this still a requested feature? |
@dgasmith yes, torch still doesn't have a hard dependency on numpy (our tests do) so this is still desirable! Sorry it took a week to get back to you--this fell in my personal inbox. |
I'll get in #232 first and then finalize this PR. It will be quite tidy to have no formal dependancies. |
@jcmgray I think this is getting much closer. I updated the outstanding items in the OP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Thanks for furthering this effort! The main reason this would be nice for PyTorch is so that we allow opt-einsum to be a more accessible dependency vs one the user has to specify when pip installing torch. To that end, we have a few test commands written in bash to ensure that we don't accidentally depend on numpy: I don't think it's crucial for opt-einsum to have similar tests, because we will test these as a downstream library, but I'm mentioning in case you were looking for similar sanity checks. |
@janeyx99 I do have a torch-only env explicitly for testing non-numpy evaluations. I like adding the check to ensure that NumPy is not present. |
Description
This PR removes NumPy from opt_einsum as a runtime dependency. The change has little effect on the opt_einsum code base but significantly effects the testing infrastructure. Several testing strategies are currently employed to help understand the most effective one. Currently, these are:
testing.py
module withpytest.skip
pytest.skip
functions wrapped in decoratorsFeedback welcome!
Todos
Notable points that this PR has either accomplished or will accomplish.
tensordot
codessa_to_linear
with a proper implementationpossibly_convert_to_numpy
is used throughout, primarily to give objects a shape attribute if they do not have one. Setting attributes on root types is difficult and would require subclassing int/float/etc to provide a shape. I'm kicking around possible solutions here.Questions
Status