CosineSimilarity
CosineSimilarity(dim=1, eps=None)
Cosine similarity of x1 and x2 along dim, with broadcasting.
The module form of clika_runtime.nn.functional.cosine_similarity:
construct it once with the settings, then call it like a function.
Args: dim: the axis reduced by the dot product and the norms. eps: the divide-by-zero floor; unset is 1e-8; None takes the function's own default.
__init__
__init__(self, dim: 'int' = 1, eps: 'float | None' = None) -> '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.cosine_similarity on x1,
x2 with the stored settings; returns a new tensor.