()
| 180 | |
| 181 | |
| 182 | def 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( |
nothing calls this directly
no test coverage detected