mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
Fixes output donation for IO ops on the GPU (#1857)
This commit is contained in:
committed by
GitHub
parent
0a5215693e
commit
0145911bea
@@ -69,4 +69,19 @@ void concatenate(std::string& acc, T first, Args... args) {
|
||||
concatenate(acc, args...);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new array that refers to the same data but has a non-owning pointer to
|
||||
* them.
|
||||
*/
|
||||
inline array unsafe_weak_copy(const array& x) {
|
||||
return array(
|
||||
x.buffer(),
|
||||
x.shape(),
|
||||
x.dtype(),
|
||||
x.strides(),
|
||||
x.data_size(),
|
||||
x.flags(),
|
||||
[](auto b) {});
|
||||
}
|
||||
|
||||
} // namespace mlx::core
|
||||
|
||||
Reference in New Issue
Block a user