What is the difference between torch.nn.PairwiseDistance and TORCH.CDIST

I tried two function. I want to calculate two embedding simliarity.

            pdist = torch.nn.PairwiseDistance(p=2)
            dist1 = pdist(out, subgraphout)
            distance = torch.cdist(out,subgraphout,p=2)
            print(dist1)
            print(distance)

tensor([3.1004, 0.8522, 0.6747, 5.0929, 7.9956, 2.2303])
tensor([[3.1004, 3.2278, 1.9171, 4.4367, 3.4980, 4.4546],
[0.5083, 0.8522, 1.6410, 1.1123, 0.7054, 1.0289],
[0.5388, 0.7062, 0.6747, 2.0988, 1.4070, 1.9033],
[3.6810, 3.7502, 2.4701, 5.0929, 4.1728, 5.0457],
[6.9577, 6.6525, 6.1944, 8.5276, 7.9956, 7.9310],
[1.2486, 0.8955, 1.2607, 2.7699, 2.3470, 2.2303]],)
I don’t understand their differences. Which one is suitable for my goal?