Skip to content

Commit

Permalink
Merge pull request #31 from dleemiller/fix-deduplicate
Browse files Browse the repository at this point in the history
shape check before equality comparison
  • Loading branch information
dleemiller authored Oct 9, 2024
2 parents 0896176 + 6cd5ee0 commit deddd6f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wordllama/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def cosine_similarity(a: np.ndarray, b: np.ndarray) -> np.ndarray:
np.ndarray: A 2D array containing the cosine similarity scores between vectors in `a` and `b`.
"""
# Normalize the vectors
if (a == b).all():
if a.shape == b.shape and (a == b).all():
a = WordLlamaInference.normalize_embeddings(a)
b = a
else:
Expand Down

0 comments on commit deddd6f

Please sign in to comment.