Yes I understand
That makes it so difficult 
This worked as per your advice:
st = theano.tensor.extra_ops.Unique(False, False, True)(delta)
But now I want to subtract 1 of the values
a = st - 1
Gives:
TypeError: unsupported operand type(s) for -: โlistโ and โintโ
Can you give me a clue?
Do I need theano.scan??
I promise that there will be no more questions in this post 
Regards Hans