Question about a special case of right padding


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:


I want to transform such input into this:


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!