chetan_patil:

condition1 = ((b>0.5) & (0.5>a) & ((b-a)>0.5))
b[condition1]-=1

condition2 = ((a>0.5) & (0.5>b) & ((a-b)>0.5))
a[condition2]-=1



I did not know that you can pass conditions like that to a tensor. Let me give it a try! Thank you so much.