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

Function test_print_in_trace

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

Source from the content-addressed store, hash-verified

180
181
182def test_print_in_trace():
183 for symbolic in [False]: # cannot read value in symbolic mode
184
185 @trace(symbolic=symbolic)
186 def f(x):
187 nonlocal buf
188 x = -x
189 buf = x.numpy()
190 x = -x
191 return x
192
193 buf = None
194 x = tensor([1])
195
196 for i in range(3):
197 y = f(x).numpy()
198 z = buf
199 buf = None
200 np.testing.assert_equal(f(x).numpy(), y)
201 np.testing.assert_equal(z, buf)
202
203
204@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 3

assert_equalMethod · 0.80
fFunction · 0.70
numpyMethod · 0.45

Tested by

no test coverage detected