(self, loss: Loss, mode: str, intraview_negs: bool = False, **kwargs)
| 16 | |
| 17 | class 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 |
nothing calls this directly
no test coverage detected