Skip to content
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

fix: removed code modifying ndarray/torch tensor methods (caused an issue with torch.compile recognising dunder methods). but added the same functionality using __torch_function__/__array_ufunc__ which are the proper mechanisms to enable this behaviour. also simplified the test #28394

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

mattbarrett98
Copy link
Contributor

@mattbarrett98 mattbarrett98 commented Feb 22, 2024

I think this code in all the backend init files is very hacky and should be avoided. the torch code specifically was causing an issue with torch.compile so needed to remove this, and also removed for numpy. There were much simpler ways to get the desired behaviour for torch/numpy using __torch_function/__array_ufunc__, though i don't think the equivalent mechanisms exist in the other frameworks so i have left them for now

…ssue with torch.compile recognising dunder methods). but added the same functionality using `__torch_function__`/`__array_ufunc__` which are the proper mechanisms to enable this behaviour. also simplified the test
@ivy-leaves ivy-leaves added the Array API Conform to the Array API Standard, created by The Consortium for Python Data API Standards label Feb 22, 2024
Copy link
Contributor

@vedpatwardhan vedpatwardhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! Feel free to merge, thanks @mattbarrett98 😄

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 26, 2024
@mattbarrett98 mattbarrett98 merged commit 116d9be into ivy-llc:main Feb 26, 2024
79 of 281 checks passed
Kacper-W-Kozdon pushed a commit to Kacper-W-Kozdon/ivy that referenced this pull request Feb 27, 2024
…ssue with torch.compile recognising dunder methods). but added the same functionality using `__torch_function__`/`__array_ufunc__` which are the proper mechanisms to enable this behaviour. also simplified the test (ivy-llc#28394)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Array API Conform to the Array API Standard, created by The Consortium for Python Data API Standards lgtm This PR has been approved by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants