-
Notifications
You must be signed in to change notification settings - Fork 108
Add tests for NumPy language context and fix import path #2690
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
base: main
Are you sure you want to change the base?
Conversation
aobolensk
commented
Oct 23, 2025
- Fix langctx module import in thunder.numpy
- Add basic tests for thunder.numpy module
- Fix langctx module import in thunder.numpy - Add basic tests for thunder.numpy module
IvanYashchuk
left a comment
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.
There's no harm in merging this PR. However, the untested state of the NumPy language context suggests that it hasn't been one of the most important aspects of Thunder for a while. It may be time to retire it and lighten the codebase.
riccardofelluga
left a comment
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.
Thank you for your contribution! just a few nits and questions
| assert len(t) == 2 # axis 0 length | ||
| assert t.size() == 6 # total elements | ||
| assert np_size(t) == 6 |
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.
Why did you choose to test these?
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.
I needed to check that any numpy function is actually working correctly under the context manager. If you have any better ideas for testing, please, suggest one, I'm ready to fix
|
|
||
|
|
||
| def test_numpy_langctx_registration_and_len_size(): | ||
| with detached_trace(): |
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.
Nice trick here
| from collections.abc import Callable | ||
|
|
||
| from thunder.core.langctx import langctx, Languages | ||
| from thunder.core.langctxs import langctx, Languages |
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.
Great catch!