# Transpose

Source:`R/gen-namespace-docs.R`

, `R/gen-namespace-examples.R`

, `R/gen-namespace.R`

`torch_transpose.Rd`

Transpose

## Arguments

- self
(Tensor) the input tensor.

- dim0
(int) the first dimension to be transposed

- dim1
(int) the second dimension to be transposed

## 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
#> -0.1925 -0.0083
#> 0.5285 -1.0425
#> 0.5759 -0.4641
#> [ CPUFloatType{3,2} ]
```