-
Notifications
You must be signed in to change notification settings - Fork 98
[Optimizer] Fix reinterpretation of strings in _get_numpy_value #2514
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
Merged
justinchuby
merged 3 commits into
microsoft:main
from
iksnagreb:fix/constant-folding-numpy-strings
Aug 27, 2025
Merged
[Optimizer] Fix reinterpretation of strings in _get_numpy_value #2514
justinchuby
merged 3 commits into
microsoft:main
from
iksnagreb:fix/constant-folding-numpy-strings
Aug 27, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Christoph Berganski <[email protected]>
justinchuby
reviewed
Aug 26, 2025
Signed-off-by: Christoph Berganski <[email protected]>
justinchuby
reviewed
Aug 27, 2025
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2514 +/- ##
==========================================
- Coverage 70.07% 70.06% -0.01%
==========================================
Files 215 215
Lines 25831 25841 +10
Branches 2596 2599 +3
==========================================
+ Hits 18100 18105 +5
- Misses 6833 6837 +4
- Partials 898 899 +1 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Christoph Berganski <[email protected]>
justinchuby
approved these changes
Aug 27, 2025
justinchuby
pushed a commit
to onnx/ir-py
that referenced
this pull request
Aug 28, 2025
…pi (#169) Getting the number of bytes in a string tensor needs special treatment as the STRING data type does not define a bitwidth but needs to be computed from flattening the strings into a sequence of bytes. See call_onnx_api querying .nbytes to temporarily remove large initializers. String initializers need to be converted to bytes via the .string_data method instead of the .tobytes method in DeduplicateInitializersPass. Also adds mapping of `np.bytes_` to `STRING` in `DataType.from_numpy`, which was probably just overlooked before, as object and `np.str_` (unicode strings) are already handled. This is related to microsoft/onnxscript#2514 --------- Signed-off-by: Christoph Berganski <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.