Sorry @richard for not good explanation. I was looking for L1 Pairwise Distance matrix of images. e.g. I have 2x2 image and its L1 Pairwise Distance matrix (within radius distance) will be 4x4
I found one way as follows
X = [[2,3],
       [-1,5]]

L1 = (X - X.t()) * indexMat
L1 = [[0,1,3,0],
[1,0,0,2],
[3,0,0,6],
[0,2,6,0]]

The same I would like to calculate for 4D CNN features of network. Any efficient way? One I think of calculate full distance matrix and multiply with nearest neighbor indices? But that matrix will be sparse and how to reduce computations?