Shortcuts

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

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources