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

Function test_dump_volatile

imperative/python/test/unit/jit/test_tracing.py:256–276  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

254
255
256def test_dump_volatile():
257 p = tensor([2])
258
259 @trace(symbolic=True, capture_as_const=True)
260 def f(x):
261 return x * p
262
263 x = tensor([3])
264 y = f(x).numpy()
265
266 for i in range(3):
267 np.testing.assert_equal(f(x).numpy(), y)
268
269 file = io.BytesIO()
270 f.dump(file, optimize_for_inference=False)
271 file.seek(0)
272 (out,) = G.load_graph(file).output_vars_list
273 assert (
274 cgtools.get_owner_opr_type(cgtools.get_owner_opr_inputs(out)[1])
275 == "ImmutableTensor"
276 )
277
278
279def test_dump_backward_graph():

Callers

nothing calls this directly

Calls 5

assert_equalMethod · 0.80
fFunction · 0.70
numpyMethod · 0.45
dumpMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected