mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-14 17:12:49 +08:00
Implements divide for integer types and adds floor_divide op (#228)
* Add floor_divide * Add floor_divide to the tests * Add floor_divide to the docs
This commit is contained in:
committed by
GitHub
parent
de892cb66c
commit
2807c6aff0
@@ -636,8 +636,7 @@ void init_array(py::module_& m) {
|
||||
"__floordiv__",
|
||||
[](const array& a, const ScalarOrArray v) {
|
||||
auto b = to_array(v, a.dtype());
|
||||
auto t = promote_types(a.dtype(), b.dtype());
|
||||
return astype(divide(a, b), t);
|
||||
return floor_divide(a, b);
|
||||
},
|
||||
"other"_a)
|
||||
.def(
|
||||
@@ -650,8 +649,7 @@ void init_array(py::module_& m) {
|
||||
"__rfloordiv__",
|
||||
[](const array& a, const ScalarOrArray v) {
|
||||
auto b = to_array(v, a.dtype());
|
||||
auto t = promote_types(a.dtype(), b.dtype());
|
||||
return astype(divide(b, a), t);
|
||||
return floor_divide(b, a);
|
||||
},
|
||||
"other"_a)
|
||||
.def(
|
||||
|
||||
Reference in New Issue
Block a user