MCPcopy Create free account
hub / github.com/PyGCL/PyGCL / __init__

Method __init__

GCL/models/contrast_model.py:18–24  ·  view source on GitHub ↗
(self, loss: Loss, mode: str, intraview_negs: bool = False, **kwargs)

Source from the content-addressed store, hash-verified

16
17class SingleBranchContrast(torch.nn.Module):
18 def __init__(self, loss: Loss, mode: str, intraview_negs: bool = False, **kwargs):
19 super(SingleBranchContrast, self).__init__()
20 assert mode == 'G2L' # only global-local pairs allowed in single-branch contrastive learning
21 self.loss = loss
22 self.mode = mode
23 self.sampler = get_sampler(mode, intraview_negs=intraview_negs)
24 self.kwargs = kwargs
25
26 def forward(self, h, g, batch=None, hn=None, extra_pos_mask=None, extra_neg_mask=None):
27 if batch is None: # for single-graph datasets

Callers

nothing calls this directly

Calls 2

get_samplerFunction · 0.90
__init__Method · 0.45

Tested by

no test coverage detected