The isfinite
function is used by the testing logic.
As Tom says, there is probably something wrong with your code. I find that I can provoke exactly that error on the verify
function if I use np.linalg.norm
to compute the distance, but specify the axis
. This has the effect of converting the answer to a 1D numpy array instead of a scalar.
Try adding a print statement like this right before your return
statement in verify
:
print(f"type(dist) = {type(dist)}")
What does that show in your case? What you want to see is this:
type(dist) <class 'numpy.float32'>
But if you see this, you’re in trouble:
type(dist) <class 'numpy.ndarray'>