torch.ravel

torch.ravel(input) → Tensor

Return a contiguous flattened tensor. A copy is made only if needed.

Parameters

input (Tensor) – the input tensor.

Example:

>>> t = torch.tensor([[[1, 2],
...                    [3, 4]],
...                   [[5, 6],
...                    [7, 8]]])
>>> torch.ravel(t)
tensor([1, 2, 3, 4, 5, 6, 7, 8])

© 2019 Torch Contributors
Licensed under the 3-clause BSD License.
https://pytorch.org/docs/1.8.0/generated/torch.ravel.html