Consider the code
np.where(1<=0, np.sqrt(-1), 0)
When running this, I get
RuntimeWarning: invalid value encountered in sqrt
array(0.)
Why is python even running (somewhere) the first branch? The above code might look stupid but I investigated after I received the error for what I have in my program:
np.where(x<= 1, np.sqrt(1-x**2), 1)
The x array contains positive elements (at least if my other code is right). It wasn't obvious if I had a mistake in my x array because usually I use torch.where, and the same warning is not thrown.