latest (dev)
Copy
Latest development documentation · Updated 2026-10-15
tensorplay.functional.flip
- tensorplay.functional.flip(input, dims) Tensor[source]
Reverse the order of an n-D tensor along given axis in dims.
Note
tensorplay.flip makes a copy of
input’s data. This is different from NumPy’s np.flip, which returns a view in constant time. Since copying a tensor’s data is more work than viewing that data, tensorplay.flip is expected to be slower than np.flip.Example:
>>> x = tensorplay.arange(8).view(2, 2, 2) >>> x tensor([[[ 0, 1], [ 2, 3]], [[ 4, 5], [ 6, 7]]]) >>> tensorplay.flip(x, [0, 1]) tensor([[[ 6, 7], [ 4, 5]], [[ 2, 3], [ 0, 1]]])
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?

