Solved by J_Johnson in post #2 
              
              
                So I found  torch.cdist creates a Euclidean distance matrix. 
So getting the average shouldn’t be an issue. 
I noticed cdist doesn’t support complex matrices. But that’s fine. I can just do this: 
vector_dims=10
n_vectors=100

A = torch.rand(n_vectors, vector_dims, dtype=torch.cfloat)

B = torch.cdi…