Skip to content

Commit

Permalink
Convert 2D ndarray to list in most_similar
Browse files Browse the repository at this point in the history
  • Loading branch information
rock420 committed Feb 20, 2022
1 parent 2c041d0 commit 330e5c2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gensim/models/keyedvectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ def _ensure_list(value):
if isinstance(value, _KEY_TYPES) or (isinstance(value, ndarray) and len(value.shape) == 1):
return [value]

if isinstance(value, ndarray) and len(value.shape) == 2:
return list(value)

return value


Expand Down

0 comments on commit 330e5c2

Please sign in to comment.