Add torch._lazy_clone to create COW tensors (#113397)

Part of #109833

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):
* __->__ #113397
Pull Request resolved: https://github.com/pytorch/pytorch/pull/113397
Approved by: https://github.com/ezyang
This commit is contained in:
Edward Z. Yang
2024-01-10 15:21:34 -05:00
committed by PyTorch MergeBot
parent 71343507cd
commit edec54b9de
8 changed files with 177 additions and 0 deletions

View File

@ -442,6 +442,10 @@
self: grad
result: auto_linear
- name: _lazy_clone(Tensor self) -> Tensor
self: grad
result: auto_linear
- name: _to_copy(Tensor self, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None, bool non_blocking=False, MemoryFormat? memory_format=None) -> Tensor
self: _to_copy_backward(grad, self.options())
result: _to_copy(self_t, dtype, layout, device, pin_memory, non_blocking, memory_format)