torch.cosine_similarity
- torch.cosine_similarity(x1, x2, dim=1, eps=1e-8) → Tensor
Returns cosine similarity between
and , computed along dim. and must be broadcastable to a common shape. refers to the dimension in this common shape. Dimension of the output is squeezed (see ), resulting in the output tensor having 1 fewer dimension.