Summary
I am applying tf.argsort() on a 3D matrix. I need to have the previous winner win ties.
Example
Array ArgSort
[5, 10, 15, 20] --> [3, 2, 1, 0]
[5, 10, 15, 20] --> [3, 2, 1, 0]
[5, 5, 15, 20] --> [3, 2, 1, 0]
[4, 4, 12, 15] --> [3, 2, 1, 0]
In row 2, the second '5' should win because it won in row 1.
In a tie, I want to be able to look at the prior rows, and sort ties by previous winners.
Notes
Also, I need to be able to do this in parallel on the GPU. I might be able to implement it with thrust zip iterators instead, but tensorflow or numpy seemed the better option since I'm working with 3D matrices of various sizes, and because of the built in argsort.