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

Function _dump_and_load

imperative/python/test/unit/utils/test_dump_naming.py:17–33  ·  view source on GitHub ↗
(func, symbolic, keep_opr_name=True)

Source from the content-addressed store, hash-verified

15
16
17def _dump_and_load(func, symbolic, keep_opr_name=True):
18 AutoNaming.clear()
19 func = trace(func, symbolic=symbolic, capture_as_const=True)
20 x = Tensor(np.ones(shape=(2, 3)))
21 func(x).numpy()
22 file = io.BytesIO()
23 func.dump(
24 file,
25 optimize_for_inference=False,
26 arg_names=("x",),
27 keep_opr_name=keep_opr_name,
28 keep_var_name=2,
29 )
30 file.seek(0)
31 outputs = G.load_graph(file).output_vars_list
32 ops = cgtools.get_oprs_seq(outputs)
33 return ops
34
35
36@pytest.mark.parametrize("symbolic", [False, True])

Callers 13

test_auto_namingFunction · 0.85
test_user_named_tensorFunction · 0.85
test_user_named_paramFunction · 0.85
test_without_moduleFunction · 0.85
test_ignore_top_moduleFunction · 0.85
test_with_submoduleFunction · 0.85
test_named_submoduleFunction · 0.85
test_with_same_operatorsFunction · 0.85
test_not_keep_opr_nameFunction · 0.85

Calls 8

traceClass · 0.90
TensorClass · 0.90
onesMethod · 0.80
funcFunction · 0.70
clearMethod · 0.45
numpyMethod · 0.45
dumpMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected