-
Notifications
You must be signed in to change notification settings - Fork 19.7k
standardize_shape normalizes the dimensions and tuple.
#21867
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
Conversation
Summary of ChangesHello @hertschuh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request improves standardize_shape by making it more robust in handling different int-like objects and by generalizing it to convert any iterable to a plain tuple, removing backend-specific code. The accompanying test changes are also great, with better organization, removal of duplicates, and addition of new test cases for the new functionality. I've found a couple of minor issues in the test file related to naming, but overall this is a solid improvement.
9664432 to
32aa942
Compare
- `standardize_shape` would allow int-like objects (e.g. NumPy scalars) to be in the shape, but would not resolve them to actual ints. This could cause issues later. With this change, objects that can be cast to int will be cast to int, which includes NumPy scalars, but also TensorFlow constant or eager tensors. - `standardize_shape` would have custom code to handle `torch.Size`. Generalized it to turn anything iterable to a plain tuple. - Added units tests - Removed duplicate unit tests - Added TensorFlow specific unit test
32aa942 to
9888260
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #21867 +/- ##
==========================================
- Coverage 82.57% 82.57% -0.01%
==========================================
Files 577 577
Lines 59568 59572 +4
Branches 9345 9344 -1
==========================================
+ Hits 49189 49191 +2
- Misses 7974 7975 +1
- Partials 2405 2406 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
standardize_shapewould allow int-like objects (e.g. NumPy scalars) to be in the shape, but would not resolve them to actual ints. This could cause issues later. With this change, objects that can be cast to int will be cast to int, which includes NumPy scalars, but also TensorFlow constant or eager tensors.standardize_shapewould have custom code to handletorch.Size. Generalized it to turn anything iterable to a plain tuple.