Documentation update torch.clone #156644 (#157007)

updated torch clone docs to reflect implemented memory behavior

Fixes #156644

Pull Request resolved: https://github.com/pytorch/pytorch/pull/157007
Approved by: https://github.com/malfet, https://github.com/svekars

Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
This commit is contained in:
Morrison Turnansky
2025-06-27 21:10:06 +00:00
committed by PyTorch MergeBot
parent 3ee75b7eac
commit 130d4973bd

View File

@ -2782,6 +2782,12 @@ Returns a copy of :attr:`input`.
result of this operation to :attr:`input`. To create a tensor without an
autograd relationship to :attr:`input` see :meth:`~Tensor.detach`.
In addition, when ``torch.preserve_format`` is used:
If the input tensor is dense (i.e., non-overlapping strided),
its memory format (including strides) is retained.
Otherwise (e.g., a non-dense view like a stepped slice),
the output is converted to the dense (contiguous) format.
Args:
{input}