-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Boolean DeviceArray to DLPack #4719
Comments
That's because DLPack has no well-defined way to represent "bool"s: I could choose an encoding arbitrarily (e.g., as int8s), but that may or may not match any other system you want to share data with, and you could also achieve that by first converting to int8 and exporting that array instead. I'm happy to add a DLPack bool export if we can agree on form it should take... |
Looks like pytorch does convert Booleans to int8s.
|
My temptation would be not to do this cast automatically: in some sense, it seems better to me to be explicit and have the user cast to |
There's no corresponding import functionality, because DLPack doesn't have a representation for booleans. Fixes jax-ml/jax#4719 PiperOrigin-RevId: 351617946 Change-Id: Ib6244be6f72c272a02d44e2e30f44d76e16bd7a7
This is now fixed at head. We allow the export of bool arrays as uint8, same as PyTorch. You can't import bool arrays (since there is no such thing as a DLPack bool array at the moment). |
Hi it seems that Boolean DeviceArray cannot be converted to DLPack?
The text was updated successfully, but these errors were encountered: