I have a 1D vector having N dimension in TensorFlow,
how to construct sum of a pairwise squared difference?
Example
Input Vector
[1,2,3]
Output
6
Computed As
(1-2)^2+(1-3)^2+(2-3)^2.
if I have input as an N-dim vector l, the output should be sigma_{i,j}((l_i-l_j)^2).
Added question: if I have a 2d matrix and want to perform the same process for each row of the matrix, and then average the results from all the rows, how can I do it? Many thanks!