@ptrblck - This is a very elegant solution. Thank you. Is there a way to apply this in the case where the mask should remove values that are equal to the previous value?
For example, suppose a tensor has:
tensor([
[0, 2.4],
[0, -4.1],
[1, 0.5],
[0, 1.6]
])
And so the mask should only keep the last two values since in the first column they are not equal to the previous value.
tensor([
[1, 0.5],
[0, 1.6]
])
How would you suggest applying a mask in this case?