Solved by ptrblck in post #2 
              
              
                No, you won’t be able to calculate the gradients after the tensor.ge operation, since it’s not differentiable and would thus break the computation graph. 
You could use a “soft” function such as e.g. sigmoid instead.