I’ve got a tensor where I want to make sure that all values in a certain axis are ascending. My idea was to slide a max over the dimension. Simple example:

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

after correction:

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

ideally, I would fold the max over a dimension using an accumulator (initialized with minus inf), but I wonder how to implement this in torch?