willow-ahrens / Finch.jl

Sparse tensors in Julia and more! Datastructure-driven array programing language.
http://willowahrens.io/Finch.jl/
MIT License
151 stars 12 forks source link

support non-boolean dtypes in `any` and `all` #575

Closed mtsokol closed 1 month ago

mtsokol commented 1 month ago

Hi @willow-ahrens,

Here's one detail for any and all. To adhere to Array API we should also support other dtypes (int, float). One option is: I can do it on finch-tensor side where I call eager astype(tns, finch.bool) to convert to bool, but then we still need support converting non-bool to bool dtypes in Finch. Or support all dtypes in any, all directly. I'm not sure what is the correct way.

willow-ahrens commented 1 month ago

Ah yes, this is a little strange because julia doesn't have a default notion of truthyness. At some point we may want to start defining some python-specific operators in finch-tensor for this kind of thing. However, in this case, could we map != 0 before any?

mtsokol commented 1 month ago

Sure! I will do it this way.

willow-ahrens commented 1 month ago

Okay, I'll close this issue then if that's alright?

mtsokol commented 1 month ago

Sure! I will reach out if != 0 won't be sufficient.