transpose

dragon.vm.torch.transpose(
  input,
  dim0,
  dim1,
  out=None
)[source]

Return a new tensor with two dimensions swapped.

Examples:

x = torch.ones(2, 3, 4)
print(torch.transpose(x, 0, 2).shape)  # (4, 3, 2)
Parameters:
  • input (dragon.vm.torch.Tensor) – The input tensor.
  • dim0 (int) – The first dimension to be transposed.
  • dim1 (int) – The second dimension to be transposed.
  • out (dragon.vm.torch.Tensor, optional) – The output tensor.
Returns:

dragon.vm.torch.Tensor – The output tensor.