API

 torch / torch


torch.flipud

torch.flipud(input) → Tensor

Flip array in the up/down direction, returning a new tensor.

Flip the entries in each column in the up/down direction. Rows are preserved, but appear in a different order than before.

Note

Equivalent to input[::-1,…]. Requires the array to be at least 1-D.

Parameters

input (Tensor) – Must be at least 1-dimensional.

Example:

>>> x = torch.arange(4).view(2, 2)
>>> x
tensor([[0, 1],
        [2, 3]])
>>> torch.flipud(x)
tensor([[2, 3],
        [0, 1]])

此页内容是否对您有帮助