Allow querying the allocator for the buffer size (#1404)

This commit is contained in:
Angelos Katharopoulos
2024-09-11 21:02:16 -07:00
committed by GitHub
parent 8b30acd7eb
commit 881f09b2e2
10 changed files with 42 additions and 13 deletions

View File

@@ -12,7 +12,7 @@ namespace mlx::core {
namespace {
void set_unary_output_data(const array& in, array& out) {
if (in.is_donatable() && in.itemsize() == out.itemsize()) {
if (is_donatable(in, out)) {
out.copy_shared_buffer(in);
} else {
auto size = in.data_size();