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

Class SameScaleSampler

GCL/models/samplers.py:32–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31
32class SameScaleSampler(Sampler):
33 def __init__(self, *args, **kwargs):
34 super(SameScaleSampler, self).__init__(*args, **kwargs)
35
36 def sample(self, anchor, sample, *args, **kwargs):
37 assert anchor.size(0) == sample.size(0)
38 num_nodes = anchor.size(0)
39 device = anchor.device
40 pos_mask = torch.eye(num_nodes, dtype=torch.float32, device=device)
41 neg_mask = 1. - pos_mask
42 return anchor, sample, pos_mask, neg_mask
43
44
45class CrossScaleSampler(Sampler):

Callers 1

get_samplerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected