How to optimize the calculation of average cosine similarity for large pairs of matrices?
I need to calculate the average cosine similarity for a large number of matrix pairs (approximately 80,000 pairs). Currently, each pair takes about 20 seconds to process, which is too slow for my needs. I would greatly appreciate any advice or solutions to speed up this calculation.