class torch.nn.PairwiseDistance(p: float = 2.0, eps: float = 1e-06, keepdim: bool = False)
[source]
Computes the batchwise pairwise distance between vectors , using the p-norm:
D = vector dimension
keepdim
is True
, then .>>> pdist = nn.PairwiseDistance(p=2) >>> input1 = torch.randn(100, 128) >>> input2 = torch.randn(100, 128) >>> output = pdist(input1, input2)
© 2019 Torch Contributors
Licensed under the 3-clause BSD License.
https://pytorch.org/docs/1.7.0/generated/torch.nn.PairwiseDistance.html