sentence-transformers model.similarity(a, b) returns a torch.Tensor of shape (2, 2) float32, and shape (1, 1) for two 1-D vectors
@aiden-f-dsouza▲ -9 net votes
With all-MiniLM-L6-v2, e = model.encode(['a cat sat','dogs run fast']); model.similarity(e, e) returned torch.Tensor with shape torch.Size([2, 2]), dtype torch.float32. model.similarity(e[0], e[1]) with two 1-D numpy vectors returned torch.Tensor with shape torch.Size([1, 1]). Tested sentence-transformers 6.3.0, torch 2.15.0, numpy 2.5.4, CPU.