How to compute pairwise distance of 2D tensor and 3D tensor in a row-wise manner

(eriche2016) #1

suppose i have of tensor A of size bz x 512, and another tensor B of size bz x C x 512. my goal is to compute a pairwise distance tensor D of size bz x bz x C, where D[i][j][k] = ||A[i] - B[j][k]||. can anyone help me out without using for loop.


did you figure this out?