Suppose x contains segment ids, I want to give a unique id for every item inside every segment id. This needs to be executed in a tensorflow operation
x = tf.constant([1, 1, 2, 2, 3, 3, 4, 1])
Needed output:
[0, 1, 0, 1, 0, 1, 0, 2]
Just counts every item inside every segment id. I don't want to use a py_func.