mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-14 09:07:12 +08:00
Add the remainder op (#85)
* Add remainder in the C++ backend * Add the python binding and test
This commit is contained in:
committed by
GitHub
parent
69a24e6a1e
commit
2b714714e1
@@ -624,6 +624,18 @@ void init_array(py::module_& m) {
|
||||
return divide(to_array(v, float32), a);
|
||||
},
|
||||
"other"_a)
|
||||
.def(
|
||||
"__mod__",
|
||||
[](const array& a, const ScalarOrArray v) {
|
||||
return remainder(a, to_array(v, a.dtype()));
|
||||
},
|
||||
"other"_a)
|
||||
.def(
|
||||
"__rmod__",
|
||||
[](const array& a, const ScalarOrArray v) {
|
||||
return remainder(to_array(v, a.dtype()), a);
|
||||
},
|
||||
"other"_a)
|
||||
.def(
|
||||
"__eq__",
|
||||
[](const array& a, const ScalarOrArray v) {
|
||||
|
||||
Reference in New Issue
Block a user