From 9b8077933ed8cb7e6988495d6d5b633ab0583081 Mon Sep 17 00:00:00 2001 From: Tim O'Donnell <timodonnell@gmail.com> Date: Sun, 27 Jan 2019 10:13:35 -0500 Subject: [PATCH] fix --- mhcflurry/common.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mhcflurry/common.py b/mhcflurry/common.py index 2b26fe79..b5120b52 100644 --- a/mhcflurry/common.py +++ b/mhcflurry/common.py @@ -29,6 +29,8 @@ def set_keras_backend(backend=None, gpu_device_nums=None, num_threads=None): """ os.environ["KERAS_BACKEND"] = "tensorflow" + original_backend = backend + if not backend: backend = "tensorflow-default" @@ -60,9 +62,10 @@ def set_keras_backend(backend=None, gpu_device_nums=None, num_threads=None): session = tensorflow.Session(config=config) K.set_session(session) else: - warnings.warn( - "Only tensorflow backend can be customized. Ignoring customization." - "Backend: %s" % K.backend()) + if original_backend or gpu_device_nums or num_threads: + warnings.warn( + "Only tensorflow backend can be customized. Ignoring " + " customization. Backend: %s" % K.backend()) def configure_logging(verbose=False): -- GitLab