pytorch
f0649d47 - update flatten.py docstring (#97276)

Commit
1 year ago
update flatten.py docstring (#97276) Carried over comment from tensor.flatten docstring to to clarify when a view vs copy is instantiated - this has been a [minor point of confusion in forums](https://discuss.pytorch.org/t/what-is-the-difference-of-flatten-and-view-1-in-pytorch/51790/5). This comment is: ``` Unlike NumPy’s flatten, which always copies input’s data, this function may return the original object, a view, or copy. If no dimensions are flattened, then the original object input is returned. Otherwise, if input can be viewed as the flattened shape, then that view is returned. Finally, only if the input cannot be viewed as the flattened shape is input’s data copied. See torch.Tensor.view() for details on when a view will be returned. ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/97276 Approved by: https://github.com/mikaylagawarecki
Author
Committer
Parents
Loading