-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
In general, cosine is not a good distance measurement for all-zero vectors. But we can't change that.
This will generate "divide by zero" problem because deno_*
is zero, the sqrt of deno_*
is also zero, and the denominator is zero.
A simple solution is to imitate pytorch to use eps
(pytorch uses 1e-8
). The denominator should always be positive (due to the squaring and then rooting).
Metadata
Metadata
Assignees
Labels
No labels