mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 00:46:28 +03:00
Consider batch_size when sorting similar vectors (#4388)
This commit is contained in:
parent
a3509f67d4
commit
d53a8d9313
|
@ -337,7 +337,7 @@ cdef class Vectors:
|
|||
scores[i:i+batch_size] = xp.partition(sims, -n, axis=1)[:,-n:]
|
||||
|
||||
if sort:
|
||||
sorted_index = xp.arange(scores.shape[0])[:,None],xp.argsort(scores, axis=1)[:,::-1]
|
||||
sorted_index = xp.arange(scores.shape[0])[:,None],xp.argsort(scores[i:i+batch_size], axis=1)[:,::-1]
|
||||
scores[i:i+batch_size] = scores[sorted_index]
|
||||
best_rows[i:i+batch_size] = best_rows[sorted_index]
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user