I have a variable that looks like
Input:  [[0,2,3,0,0,0,1,2],
[0,0,1,3,0,0,5,0]]
and I want to end up with the following variable
Output: [[2,3,1,2,0,0,0,0],
[1,3,5,0,0,0,0,0]]
I have tried the a[a.nonzero()] if a is the input, but it only works in 1xn dims
Is there a way to do this in PyTorch?