mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 09:07:10 +08:00
[Bug Fix] fix cosine_similarity error in examples (#648)
cosine_similarity is error 余弦相似度计算错误 np.linalg.norm 二范数 已经开过根号 Co-Authored-By: Chris Kong <chriskong93@163.com>
This commit is contained in:
@@ -10,7 +10,7 @@ def cosine_similarity(a, b):
|
||||
mul_a = np.linalg.norm(a, ord=2)
|
||||
mul_b = np.linalg.norm(b, ord=2)
|
||||
mul_ab = np.dot(a, b)
|
||||
return mul_ab / (np.sqrt(mul_a) * np.sqrt(mul_b))
|
||||
return mul_ab / (mul_a * mul_b)
|
||||
|
||||
|
||||
def parse_arguments():
|
||||
|
Reference in New Issue
Block a user