Flip

torch_flip(self, dims)

Arguments

self

(Tensor) the input tensor.

dims

(a list or tuple) axis to flip on

flip(input, dims) -> Tensor

Reverse the order of a n-D tensor along given axis in dims.

Examples

if (torch_is_installed()) { x = torch_arange(0, 8)$view(c(2, 2, 2)) x torch_flip(x, c(1, 2)) }
#> torch_tensor #> (1,.,.) = #> 6 7 #> 4 5 #> #> (2,.,.) = #> 2 3 #> 0 1 #> [ CPUFloatType{2,2,2} ]