Skip to content

Commit

Permalink
Update test.py
Browse files Browse the repository at this point in the history
Remove unused variable
  • Loading branch information
surisdi committed Mar 7, 2021
1 parent dbf75c9 commit 0efe696
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions test.py
Expand Up @@ -240,7 +240,6 @@ def _process_alignment_languages(list_numbers=None, list_numbers_query=None, lan
topk_values = similarities_i[np.tile(np.array(range(lang_vector_i.shape[0]))[..., np.newaxis], (1, K)), topk_indices]
mean_similarity[start:end] = topk_values.mean(1)

predictions = [0, 0]
histogram = np.zeros(text_predictions.shape[0])
if cosine:
text_predictions = text_predictions / np.sqrt((text_predictions ** 2).sum(-1)[..., np.newaxis])
Expand Down Expand Up @@ -271,12 +270,6 @@ def _process_alignment_languages(list_numbers=None, list_numbers_query=None, lan
similarities_i[lang_vector_expanded_1 == lang_vector_expanded_2] = -1000
# similarities_i = similarities_i.astype(np.float16)

max_sim = similarities_i.argmax(axis=1)
for j in range(similarities_i.shape[0]):
predictions[0] += 1 # Count
if list_numbers[max_sim[j]] == list_numbers_query[start+j]:
predictions[1] += 1

# Besides computing the argmax, we also compute the position for all 49 positive examples, to create histogram
sorted_idx = (-similarities_i).argsort()
list_numbers_ = list_numbers[sorted_idx]
Expand Down

0 comments on commit 0efe696

Please sign in to comment.