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

Function test_update_routines

tests/python/common/function/test_basics.py:352–386  ·  view source on GitHub ↗
(idtype)

Source from the content-addressed store, hash-verified

350
351@parametrize_idtype
352def test_update_routines(idtype):
353 g = generate_graph(idtype)
354
355 # send_and_recv
356 reduce_msg_shapes.clear()
357 u = [0, 0, 0, 4, 5, 6]
358 v = [1, 2, 3, 9, 9, 9]
359 g.send_and_recv((u, v), message_func, reduce_func, apply_node_func)
360 assert reduce_msg_shapes == {(1, 3, D), (3, 1, D)}
361 reduce_msg_shapes.clear()
362 try:
363 g.send_and_recv([u, v])
364 assert False
365 except:
366 pass
367
368 # pull
369 v = F.tensor([1, 2, 3, 9], g.idtype)
370 reduce_msg_shapes.clear()
371 g.pull(v, message_func, reduce_func, apply_node_func)
372 assert reduce_msg_shapes == {(1, 8, D), (3, 1, D)}
373 reduce_msg_shapes.clear()
374
375 # push
376 v = F.tensor([0, 1, 2, 3], g.idtype)
377 reduce_msg_shapes.clear()
378 g.push(v, message_func, reduce_func, apply_node_func)
379 assert reduce_msg_shapes == {(1, 3, D), (8, 1, D)}
380 reduce_msg_shapes.clear()
381
382 # update_all
383 reduce_msg_shapes.clear()
384 g.update_all(message_func, reduce_func, apply_node_func)
385 assert reduce_msg_shapes == {(1, 8, D), (9, 1, D)}
386 reduce_msg_shapes.clear()
387
388
389@parametrize_idtype

Callers

nothing calls this directly

Calls 6

send_and_recvMethod · 0.80
update_allMethod · 0.80
generate_graphFunction · 0.70
clearMethod · 0.45
pullMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected