From 7b2a13c04b24f7bf414ae02052717b170ab333ce Mon Sep 17 00:00:00 2001 From: Carlos Mocholi Date: Fri, 26 Mar 2021 01:41:12 +0100 Subject: [PATCH] Do not describe when there's no summary --- pytorch_lightning/profiler/profilers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pytorch_lightning/profiler/profilers.py b/pytorch_lightning/profiler/profilers.py index bc9e3541dbaa8..78327fa0a91d8 100644 --- a/pytorch_lightning/profiler/profilers.py +++ b/pytorch_lightning/profiler/profilers.py @@ -148,7 +148,9 @@ def describe(self) -> None: # so to avoid them, we open and close the files within this function # by calling `_prepare_streams` and `teardown` self._prepare_streams() - self._write_stream(self.summary()) + summary = self.summary() + if summary: + self._write_stream(summary) if self._output_file is not None: self._output_file.flush() self.teardown(stage=self._stage)