nnf_pdist: Pdist

View source: R/nnf-distance.R

nnf_pdistR Documentation

Pdist

Description

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[:, None] - input, dim=2, p=p)⁠. This function will be faster if the rows are contiguous.

Usage

nnf_pdist(input, p = 2)

Arguments

input

input tensor of shape N \times M.

p

p value for the p-norm distance to calculate between each vector pair \in [0, \infty].

Details

If input has shape N \times M then the output will have shape \frac{1}{2} N (N - 1).


torch documentation built on May 29, 2024, 9:54 a.m.