What is dem1 and dem2 in torch.transpose ?

What is dem1 and dem2 in torch.transpose ?

I guess you mean dim not dem.

When transposing a tensor you might need to specify which dimension you want to transpose actually. In case of matrices the answer is simple, because there are only 2 dimensions. Anything higher-dimensional requires to specify the dimension that will be transposed.

1 Like

In torch.transpose you have parameters such as input(tensor) and two dimensions(d1 and d2)(int). This operation returns a new tensor where we get a new tensor version of the input tensor with dimension d1 and d2 being swapped.