Question about a special case of right padding

Hello!

I want to invert the padding of the last dimension of my input tensor from the left to the right.

For example, the last dimension of my tensor may look like this:

[0,0,0,1,2,3]
[0,1,2,3,4,5]
[0,0,1,2,3,4]
[1,2,3,4,5,6]

I want to transform such input into this:

[1,2,3,0,0,0]
[1,2,3,4,5,0]
[1,2,3,4,0,0]
[1,2,3,4,5,6]

I wonder if there is a clean way to achieve this? My tensor is quite large so I’d like to find a solution that does not require iterating through all rows/columns.

Thank you!