Equivalent to theano.tensor.dimshuffle in pytorch?

As shown in the title, I want to know what is the function in pytorch that is equivalent to theano.tensor.dimshuffle or np.dimshuffle?

Thanks!

torch.permute() for swapping dimensions
torch.unsqueeze() to add an extra dimension

these two should serve you right

3 Likes

Thank you very much!