From 82a6ba4c50b3880dfd98d4a1706d0c7422ad7639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cjaketae=E2=80=9D?= Date: Mon, 2 Mar 2020 06:46:35 +0900 Subject: [PATCH] Fix plot_model for PDF --- tensorflow/python/keras/utils/vis_utils.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tensorflow/python/keras/utils/vis_utils.py b/tensorflow/python/keras/utils/vis_utils.py index 1af6e00cbf9..d09fd30bd7c 100644 --- a/tensorflow/python/keras/utils/vis_utils.py +++ b/tensorflow/python/keras/utils/vis_utils.py @@ -293,8 +293,9 @@ def plot_model(model, # Return the image as a Jupyter Image object, to be displayed in-line. # Note that we cannot easily detect whether the code is running in a # notebook, and thus we always return the Image if Jupyter is available. - try: - from IPython import display - return display.Image(filename=to_file) - except ImportError: - pass + if extension != 'pdf': + try: + from IPython import display + return display.Image(filename=to_file) + except ImportError: + pass