cosine_similarity

dragon.vm.torch.nn.functional.cosine_similarity(
  x1,
  x2,
  dim=1,
  eps=1e-08
)[source]

Compute the cosine similarity between inputs.

Parameters:
  • x1 (dragon.vm.torch.Tensor) – The first input tensor.
  • x2 (dragon.vm.torch.Tensor) – The second input tensor.
  • dim (int, optional, default=1) – The vector dimension.
  • eps (float, optional, default=1e-8) – The epsilon value.
Returns:

dragon.vm.torch.Tensor – The output tensor.