MCPcopy Index your code
hub / github.com/PyGCL/PyGCL / WithinEmbedContrast

Class WithinEmbedContrast

GCL/models/contrast_model.py:111–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109
110
111class WithinEmbedContrast(torch.nn.Module):
112 def __init__(self, loss: Loss, **kwargs):
113 super(WithinEmbedContrast, self).__init__()
114 self.loss = loss
115 self.kwargs = kwargs
116
117 def forward(self, h1, h2):
118 l1 = self.loss(anchor=h1, sample=h2, **self.kwargs)
119 l2 = self.loss(anchor=h2, sample=h1, **self.kwargs)
120 return (l1 + l2) * 0.5

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected