ptrblck:

x.permute(1, 0)


Thank you for the quick response. For a more general case, suppose If I want to move a sliding window with overlapping columns, is there any approach without writing any loops.
For example in y  I want first column to be first and second columns of x stacked, and second column of y to be second and third columns of x stacked together.