MCPcopy Index your code
hub / github.com/dmlc/dgl / reducer

Function reducer

tests/python/common/function/test_basics.py:776–779  ·  view source on GitHub ↗
(nodes)

Source from the content-addressed store, hash-verified

774 g.edata["eid"] = F.copy_to(F.arange(0, 10), F.ctx())
775
776 def reducer(nodes):
777 eid = F.asnumpy(F.copy_to(nodes.mailbox["eid"], F.cpu()))
778 assert np.array_equal(eid, np.sort(eid, 1))
779 return {"n": F.sum(nodes.mailbox["eid"], 1)}
780
781 g.update_all(fn.copy_e("eid", "eid"), reducer)
782

Callers 1

add_self_loopFunction · 0.85

Calls 3

asnumpyMethod · 0.80
copy_toMethod · 0.45
cpuMethod · 0.45

Tested by

no test coverage detected