Solved by dianlujitao in post #3 
              
              
                Thanks for replying. 
Slightly changed and it works: 
a = a.permute(1, 0, 2).reshape(a.shape[1], -1)

.view() doesn’t work, it asked me to “Call .contiguous() before .view()”, I guess memory copy is unavoidable.