MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / test_io2

Function test_io2

imperative/python/test/unit/core/test_megbrain_graph.py:25–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23
24
25def test_io2():
26 g = mgb_graph.Graph()
27 g.options.async_exec_level = 0b100
28 dtype, device = "float32", "xpux"
29 px = mgb_graph.InputNode(device=device, dtype=dtype, graph=g)
30 py = mgb_graph.OutputNode(px.outputs[0])
31 f = g.compile(py.outputs[0])
32
33 for _ in range(3):
34 f.execute()
35 x = Tensor(np.random.randn(10).astype(dtype), device=device)._dev_tensor()
36 px.set_value(x)
37 y = py.get_value()
38 np.testing.assert_equal(x.numpy(), y.numpy())
39 f.wait()
40
41
42def test_attr_output():

Callers

nothing calls this directly

Calls 10

compileMethod · 0.95
set_valueMethod · 0.95
get_valueMethod · 0.95
TensorClass · 0.90
_dev_tensorMethod · 0.80
assert_equalMethod · 0.80
executeMethod · 0.45
astypeMethod · 0.45
numpyMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected