torch_pdist {torch} | R Documentation |
Pdist
Description
Pdist
Usage
torch_pdist(self, p = 2L)
Arguments
self |
NA input tensor of shape |
p |
NA p value for the p-norm distance to calculate between each vector pair |
pdist(input, p=2) -> Tensor
Computes the p-norm distance between every pair of row vectors in the input.
This is identical to the upper triangular portion, excluding the diagonal, of
torch_norm(input[:, NULL] - input, dim=2, p=p)
. This function will be faster
if the rows are contiguous.
If input has shape then the output will have shape
.
This function is equivalent to scipy.spatial.distance.pdist(input, 'minkowski', p=p)
if . When
it is
equivalent to
scipy.spatial.distance.pdist(input, 'hamming') * M
.
When , the closest scipy function is
scipy.spatial.distance.pdist(xn, lambda x, y: np.abs(x - y).max())
.
[Package torch version 0.13.0 Index]