Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix for similarity return types #10051

Merged
merged 1 commit into from
Jan 20, 2022

Conversation

richardpaulhudson
Copy link
Contributor

Description

In the past, calls to Lexeme.similarity(), Span.similarity() and Token.similarity() have returned inconsistent return types: depending on whether or not matrix multiplication was performed to determine the similarity and whether or not Numpy (CPU) or Cupy (GPU) was in use, the return value could be a native Python float, a Numpy float or a Cupy array. This pull request duplicates the pre-existing behaviour of Doc.similarity() and ensures that all return values are native floats.

Types of change

Bug fix

Checklist

  • I confirm that I have the right to submit this contribution under the project's MIT license.
  • I ran the tests, and all new and existing tests passed.
  • My changes don't require a change to the documentation, or if they do, I've added all required information.

@richardpaulhudson richardpaulhudson added bug Bugs and behaviour differing from documentation feat / vectors Feature: Word vectors and similarity gpu Using spaCy on GPU labels Jan 13, 2022
@adrianeboyd
Copy link
Contributor

@explosion-bot please test_gpu

@explosion-bot
Copy link
Collaborator

explosion-bot commented Jan 17, 2022

🪁 Successfully triggered build on Buildkite

URL: https://buildkite.com/explosion-ai/spacy-gpu-test-suite/builds/53

Copy link
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! And it looks like the test suite is also happy on GPU so we can go ahead and merge this :-)

@svlandeg svlandeg merged commit e9c6314 into explosion:master Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs and behaviour differing from documentation feat / vectors Feature: Word vectors and similarity gpu Using spaCy on GPU
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants