MCPcopy
hub / github.com/dmlc/dgl / _test_sampler

Function _test_sampler

tests/python/common/sampling/test_sampling.py:320–327  ·  view source on GitHub ↗
(g, sampler, ntype)

Source from the content-addressed store, hash-verified

318 pytest.skip("UVA sampling requires a GPU.")
319
320 def _test_sampler(g, sampler, ntype):
321 seeds = F.copy_to(F.tensor([0, 2], dtype=g.idtype), F.ctx())
322 neighbor_g = sampler(seeds)
323 assert neighbor_g.ntypes == [ntype]
324 u, v = neighbor_g.all_edges(form="uv", order="eid")
325 uv = list(zip(F.asnumpy(u).tolist(), F.asnumpy(v).tolist()))
326 assert (1, 0) in uv or (0, 0) in uv
327 assert (2, 2) in uv or (3, 2) in uv
328
329 g = dgl.heterograph(
330 {

Callers 1

test_pinsage_samplingFunction · 0.85

Calls 4

all_edgesMethod · 0.80
asnumpyMethod · 0.80
copy_toMethod · 0.45
ctxMethod · 0.45

Tested by

no test coverage detected