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

Function test_io

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

Source from the content-addressed store, hash-verified

9
10
11def test_io():
12 g = mgb_graph.Graph()
13 x = Tensor(np.random.randn(3).astype("float32"), device="xpux")._dev_tensor()
14 vx, _ = mgb_graph.input_callback(
15 lambda: x, device=x.comp_node, dtype=x.dtype, graph=g
16 )
17 y = Future()
18 v = mgb_graph.output_callback(y.set_result, vx)
19 f = g.compile(v)
20 f()
21
22 np.testing.assert_equal(x.numpy(), y.result().numpy())
23
24
25def test_io2():

Callers

nothing calls this directly

Calls 8

compileMethod · 0.95
TensorClass · 0.90
_dev_tensorMethod · 0.80
assert_equalMethod · 0.80
fFunction · 0.70
FutureClass · 0.50
astypeMethod · 0.45
numpyMethod · 0.45

Tested by

no test coverage detected