Skip to main content

PairwiseDistance

PairwiseDistance(p=2.0, eps=None, keepdim=False)

The p-norm of x1 - x2 + eps over the last axis, with broadcasting of the leading dimensions.

The module form of clika_runtime.nn.functional.pairwise_distance: construct it once with the settings, then call it like a function.

Args: p: the norm degree; an integer keeps its kind. eps: the perturbation added before the norm; unset is 1e-6; None takes the function's own default. keepdim: keeps the reduced axis as size 1.

__init__​

__init__(self, p: 'bool | int | float' = 2.0, eps: 'float | None' = None, keepdim: 'bool' = False) -> 'None'

Initialize self. See help(type(self)) for accurate signature.

extra_repr​

extra_repr(self) -> 'str'

extra_repr() -> str

One line of per-class detail for :meth:__repr__; a layer prints its geometry here (in_features=64, out_features=256).

forward​

forward(self, x1: 'Tensor', x2: 'Tensor') -> 'Tensor'

forward(x1, x2) -> Tensor

Runs clika_runtime.nn.functional.pairwise_distance on x1, x2 with the stored settings; returns a new tensor.