Rate this Page
โ˜… โ˜… โ˜… โ˜… โ˜…

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])