Hello, I’m trying to understand the CosineSimilarity for tensors with different dimensions. I don’t quite understand the reason why the output is >1. Shouldn’t cosine similarity always be between -1 to 1?
from torch.nn import CosineSimilarity as cs
f = torch.tensor([[3,2]], dtype = torch.float)
g = torch.tensor([[3,2],[1,2]], dtype = torch.float)
cos = cs(dim =0,eps = 0.3)
z = cos(d,e)
print(z)
output: tensor([1.2649, 1.4142])