Lazily format graphs for debug printing (#98776)
The current code unconditionally formats the graphs, which is a
waste of CPU if no one looks at them.
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98776
Approved by: https://github.com/albanD, https://github.com/mlazos