minerva.losses.negative_cossine_similatiry

Classes

NegativeCosineSimilarity

Implementation of the Negative Cosine Simililarity used in the SimSiam[0] paper.

Module Contents

class minerva.losses.negative_cossine_similatiry.NegativeCosineSimilarity(dim=1, eps=1e-08)[source]

Bases: torch.nn.Module

Implementation of the Negative Cosine Simililarity used in the SimSiam[0] paper. [0] SimSiam, 2020, https://arxiv.org/abs/2011.10566

Same parameters as in torch.nn.CosineSimilarity

Args:
dim (int, optional):

Dimension where cosine similarity is computed. Default: 1

eps (float, optional):

Small value to avoid division by zero. Default: 1e-8

Parameters:
  • dim (int)

  • eps (float)

dim = 1
eps = 1e-08
forward(x0, x1)[source]
Parameters:
  • x0 (torch.Tensor)

  • x1 (torch.Tensor)

Return type:

torch.Tensor