(idtype)
| 320 | |
| 321 | @parametrize_idtype |
| 322 | def test_apply_nodes(idtype): |
| 323 | def _upd(nodes): |
| 324 | return {"h": nodes.data["h"] * 2} |
| 325 | |
| 326 | g = generate_graph(idtype) |
| 327 | old = g.ndata["h"] |
| 328 | g.apply_nodes(_upd) |
| 329 | assert F.allclose(old * 2, g.ndata["h"]) |
| 330 | u = F.tensor([0, 3, 4, 6], g.idtype) |
| 331 | g.apply_nodes(lambda nodes: {"h": nodes.data["h"] * 0.0}, u) |
| 332 | assert F.allclose(F.gather_row(g.ndata["h"], u), F.zeros((4, D))) |
| 333 | |
| 334 | |
| 335 | @parametrize_idtype |
nothing calls this directly
no test coverage detected