Return empty array when repeats is 0 in mx.repeat (#681)

* Return empty array when repeats is 0

* Add test case for repeats = 0
This commit is contained in:
Noah Farr
2024-02-14 02:49:31 +01:00
committed by GitHub
parent 2fdc2462c3
commit 0c65517e91
2 changed files with 3 additions and 1 deletions

View File

@@ -774,7 +774,7 @@ array repeat(const array& arr, int repeats, int axis, StreamOrDevice s) {
}
if (repeats == 0) {
return array({}, arr.dtype());
return array(std::initializer_list<int>{}, arr.dtype());
}
if (repeats == 1) {