-
Notifications
You must be signed in to change notification settings - Fork 45
Fix test_reshape #319
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 test_reshape #319
Conversation
This is the failure:
which is the same issue from #238. That issue was fixed at #242 It's not clear to me how the reshape strategies are generating too large of inputs. However, I do notice some other issues with them, like that the reshape shape is generated using filtering. I don't know if that's related, but it should be fixed anyways. |
- Fix the input strategy to not generate arrays that are too large, which was causing an error from hypothesis. - Rewrite the reshape_shapes() strategy to generate reshape tuples directly by distributing the prime factors of the array size, rather than by using filtering.
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.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no suggestions.
Comments skipped due to low confidence (2)
array_api_tests/hypothesis_helpers.py:268
- The use of math.prod should be consistent with the rest of the codebase. Consider using the existing prod function instead.
array_size = math.prod(shape)
array_api_tests/hypothesis_helpers.py:261
- Ensure that the new reshape_shapes function is covered by tests.
@composite
I have a fix here. The test should be working properly now. It was generating arrays that were too large. I also went ahead and redid the reshape_shapes strategy to generate reshape compatible shapes more directly. This approach could in principle be applied more broadly wherever we do a filter on size, although filtering on a max size (inequality) isn't as big of a deal as trying to filter against an exact size. |
This is great, let's land it straight away. |
No description provided.