Programming, Artificial Intelligence, Machine Learning, Data Science, Python.
torch.mean(original_embedding, dim=1) avg_embedding_scrambled = torch.mean(scrambled_embedding, dim=1) similarity = cosine_similarity(avg_embedding_original, avg_embedding_scrambled) print(f"Cosine similarity between original and scrambled sentence embeddings: {similarity.item():.2f}") Cosine