-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change
pack_tensor
to do unsafe casting when an explicit dtype is p…
…rovided. This fixes issues when running with NumPy 2.0. Previously, we would cast using `same_kind`, which mean't only "safe" casts or casts within a kind, like float64 to float32, were allowed. In NumPy 2.0, the meaning of `same_kind` changed such that unsigned and signed integers are no longer deemed the same. Considering it was still possible for data loss even when using same_kind casting, we propose changing to use `unsafe` when an explicit dtype is provided, requiring the end user to ensure the value being packed in compatible with the dtype. PiperOrigin-RevId: 678408939 Change-Id: I1770714fb23335f5ee1a9ae5b7f6263394bb8297
- Loading branch information
1 parent
b6ba877
commit c6b8435
Showing
3 changed files
with
3 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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