+
Skip to content

Conversation

nkoppel
Copy link
Contributor

@nkoppel nkoppel commented Jan 29, 2023

Implements and, or, xor, and not 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.

@nkoppel nkoppel changed the title Add boolean operations (and where_to soon) Add boolean operations (and where soon) Jan 29, 2023
@nkoppel nkoppel changed the title Add boolean operations (and where soon) Add boolean operations (and where soon) Jan 29, 2023
@nkoppel nkoppel changed the title Add boolean operations (and where soon) Add boolean operations (and 'where' soon) Jan 29, 2023
@nkoppel nkoppel changed the title Add boolean operations (and 'where' soon) Add boolean operations and choose. Jan 29, 2023
@coreylowman
Copy link
Owner

Looking great on first read through - probably going to need a couple more days with this one 😀

Copy link
Owner

@coreylowman coreylowman left a 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";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick for consistency

Suggested change
const MODULE_NAME: &str = "/boolean.ptx";
const MODULE_NAME: &str = "boolean";

@coreylowman coreylowman linked an issue Feb 2, 2023 that may be closed by this pull request
@coreylowman coreylowman merged commit 72f2255 into coreylowman:main Feb 2, 2023
@coreylowman
Copy link
Owner

Thanks for the contribution! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tensor_ops::where to replace value_mask

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载