-
-
Notifications
You must be signed in to change notification settings - Fork 104
Add boolean operations and choose. #415
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
where
soon)
where
soon)
Looking great on first read through - probably going to need a couple more days with this one 😀 |
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.
this is looking great! I really like the choose method, great idea! Added a few structural comments, but definitely getting close on this one, thanks for the work!
|
||
use std::sync::Arc; | ||
|
||
const MODULE_NAME: &str = "/boolean.ptx"; |
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.
nitpick for consistency
const MODULE_NAME: &str = "/boolean.ptx"; | |
const MODULE_NAME: &str = "boolean"; |
Thanks for the contribution! 🚀 |
Implements
and
,or
,xor
, andnot
for Tensors. In the process, however, I expanded the definition of OnesTensor and OneFillTensor to all implementors of Unit, which caused Cpu and Cuda to implement Device for all implementors of Unit. Because of this, we now have to specify tensors' dtypes more often.I also had to use take_async instead of alloc_zeros_async to create the result tensors because cudarc doesn't currently implement ValidAsZeroBits for booleans. This is already fixed in cudarc's latest main, so this can be changed the next time cudarc releases. I figured that take_async was preferred to transmuting a CudaSlice<u8> to a CudaSlice<bool>.
Now also implements
choose
, resolving #305.