Removes reference cycles in `func_graph` FuncGraph. Helpful for making sure the garbage collector doesn't need to run when the FuncGraph goes out of scope, e.g. in tests using defun with @test_util.run_in_graph_and_eager_modes(assert_no_eager_garbage=True). Args: func_graph: A `FuncGra
(func_graph)
| 1172 | |
| 1173 | |
| 1174 | def dismantle_func_graph(func_graph): |
| 1175 | """Removes reference cycles in `func_graph` FuncGraph. |
| 1176 | |
| 1177 | Helpful for making sure the garbage collector doesn't need to run when |
| 1178 | the FuncGraph goes out of scope, e.g. in tests using defun with |
| 1179 | @test_util.run_in_graph_and_eager_modes(assert_no_eager_garbage=True). |
| 1180 | |
| 1181 | Args: |
| 1182 | func_graph: A `FuncGraph` object to destroy. `func_graph` is unusable |
| 1183 | after this function. |
| 1184 | """ |
| 1185 | func_graph.clear_captures() |
| 1186 | ops.dismantle_graph(func_graph) |
nothing calls this directly
no test coverage detected