0votes
3 answersPyTorch errors: "The size of tensor a (384) must match the size of tensor b (768)" or "Dimension out of range" in cosine_similarity
torch.nn.functional.cosinesimilarity fails with a size or dimension error.

Find answers to your programming questions.
torch.nn.functional.cosinesimilarity fails with a size or dimension error.
I used Hugging Face AutoModel to create embeddings. The output has an extra dimension, and every similarity function rejects it.