Ensure doc.similarity returns a float (on develop)
@@ -391,7 +391,9 @@ cdef class Doc:
return 0.0
vector = self.vector
xp = get_array_module(vector)
- return xp.dot(vector, other.vector) / (self.vector_norm * other.vector_norm)
+ result = xp.dot(vector, other.vector) / (self.vector_norm * other.vector_norm)
+ # ensure we get a scalar back (numpy does this automatically but cupy doesn't)
+ return result.item()
@property
def has_vector(self):
