Bitwise Inverse (#1862)

* add bitwise inverse

* add vmap + fix nojit

* inverse -> invert

* add to compile + remove unused
This commit is contained in:
Alex Barron
2025-02-13 08:44:14 -08:00
committed by GitHub
parent e425dc00c0
commit 5cd97f7ffe
19 changed files with 147 additions and 8 deletions
+3 -4
View File
@@ -745,11 +745,10 @@ void init_array(nb::module_& m) {
throw std::invalid_argument(
"Floating point types not allowed with bitwise inversion.");
}
if (a.dtype() != mx::bool_) {
throw std::invalid_argument(
"Bitwise inversion not yet supported for integer types.");
if (a.dtype() == mx::bool_) {
return mx::logical_not(a);
}
return mx::logical_not(a);
return mx::bitwise_invert(a);
})
.def(
"__and__",