()
| 254 | |
| 255 | |
| 256 | def 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 | |
| 279 | def test_dump_backward_graph(): |
nothing calls this directly
no test coverage detected