Transpose
Source:R/gen-namespace-docs.R, R/gen-namespace-examples.R, R/gen-namespace.R
torch_transpose.RdTranspose
transpose(input, dim0, dim1) -> Tensor
Returns a tensor that is a transposed version of input.
The given dimensions dim0 and dim1 are swapped.
The resulting out tensor shares it's underlying storage with the
input tensor, so changing the content of one would change the content
of the other.
Examples
if (torch_is_installed()) {
x = torch_randn(c(2, 3))
x
torch_transpose(x, 1, 2)
}
#> torch_tensor
#> -1.0414 -2.0828
#> 2.2183 0.4549
#> -0.6943 -0.1622
#> [ CPUFloatType{3,2} ]