zfit.run.clear_graph_cache#

run.clear_graph_cache()#

Clear all generated graphs and effectively reset. Should not affect execution, only performance.

In a simple fit scenario, this is not used. But if several fits are performed with different python objects such as a scan over a range (by changing the norm_range and creating a new dataset), doing minimization and therefore invoking the loss (by default creating a graph) will leave the graphs in the cache, even tough the already scanned ranges are not needed anymore.

To clean, this function can be invoked. The only effect should be to speed up things, but should not have any side-effects other than that.

Parameters:

call_gc (bool | None) –

If True, call the garbage collector after clearing the cache. This can help if there are issues with non-cleared graphs.

(it can impact the performance if called in a loop, as the gc can take up to a second)