I don’t think you can use (1-x) if x is a variable. Negation is not possible on bytetensor variables. You should do something like (1-x.data) which is pretty ugly and perhaps inefficient for something as simple as logical not.