Premium problem22. Pairwise Distances

Medium Locked

Z is an (n, 2) float tensor of coordinates. Return the (n, n) matrix of pairwise Euclidean distances between every pair of rows.

Input

tensor([[0., 0.],
        [3., 4.],
        [6., 8.]])

Output

tensor([[ 0.,  5., 10.],
        [ 5.,  0.,  5.],
        [10.,  5.,  0.]])

Premium problem

This one's part of Premium. Unlock the full PyTorch track plus every other premium problem on the site.

Implement solve(...)