I think your problem is more mathematical than pytorch.
The only possible transpose of a vector is itself, since it is of dimension in R (I say of dimension, the vector can itself be an element of R^n, n >= 1).
For example a = torch.arange(1, 7) just creates a vector of R^6, but remains of dimension in R, a scalar (a.shape = torch.Size([6]) ~ 6 € IR), so the only possible transpose is a.transpose(0,0) and is a: we have only one dimension, the dimension 0 (1-1)
But a = torch.rand((2, 4, 3)) is an element of R^2 x R^4 x R^3, so of dimension in R^3 (a.shape = torch.Size([2, 3, 7])), so we can transpose the dimension :

0 with 1 (a.transpose(0, 1) = a.transpose(1, 0), of shape = torch.Size([4, 2, 3])) or 2 (a.transpose(0,2) = a.transpose(2,0))
1 with 2 (a.transpose(1, 2) = a.transpose(2, 1), of shape = torch.Size([2, 3, 4])`)
we can’t go beyond 2 = 3-1, because the created tensor is of dimension in R^3 (I say of dimension) : take some linear algebra course if necessary