From b730a5a281f3af077c7378d5952951f68aa2c34e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Fri, 26 Mar 2021 15:58:05 +0100 Subject: [PATCH] Do not describe when there's no summary (#6681) --- 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 bc9e3541db..78327fa0a9 100644 --- a/pytorch_lightning/profiler/profilers.py +++ b/pytorch_lightning/profiler/profilers.py @@ -148,7 +148,9 @@ class BaseProfiler(AbstractProfiler): # 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)