Skip to content

Commit 0f21fa8

Browse files
morrison-turnanskypytorchmergebot
authored andcommitted
Documentation Fix: torch.empty_like memory preservation (pytorch#158050)
updated docs for torch.empty_like to reflect view and dense memory behavior Fixes pytorch#158022 Pull Request resolved: pytorch#158050 Approved by: https://github.com/ngimel, https://github.com/cyyever
1 parent aa11628 commit 0f21fa8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

torch/_torch_docs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12138,6 +12138,12 @@ def merge_dicts(*dicts):
1213812138
Floating point and complex tensors are filled with NaN, and integer tensors
1213912139
are filled with the maximum value.
1214012140
12141+
When ``torch.preserve_format`` is used:
12142+
If the input tensor is dense (i.e., non-overlapping strided),
12143+
its memory format (including strides) is retained.
12144+
Otherwise (e.g., a non-dense view like a stepped slice),
12145+
the output is converted to the dense format.
12146+
1214112147
Args:
1214212148
{input}
1214312149

0 commit comments

Comments
 (0)