Add contiguous_copy_cpu util for copying array (#2397)

This commit is contained in:
Cheng
2025-07-21 23:30:35 +09:00
committed by GitHub
parent f55c4ed1d6
commit 56cc858af9
8 changed files with 17 additions and 18 deletions

View File

@@ -377,4 +377,10 @@ void copy_cpu_inplace(
});
}
array contiguous_copy_cpu(const array& arr, Stream stream) {
array arr_copy(arr.shape(), arr.dtype(), nullptr, {});
copy_cpu(arr, arr_copy, CopyType::General, stream);
return arr_copy;
}
} // namespace mlx::core