torch.
flip
Reverse the order of a n-D tensor along given axis in dims.
input (Tensor) – the input tensor.
dims (a list or tuple) – axis to flip on
Example:
>>> x = torch.arange(8).view(2, 2, 2) >>> x tensor([[[ 0, 1], [ 2, 3]], [[ 4, 5], [ 6, 7]]]) >>> torch.flip(x, [0, 1]) tensor([[[ 6, 7], [ 4, 5]], [[ 2, 3], [ 0, 1]]])
此页内容是否对您有帮助
感谢反馈!