From 2cc9ebf28bef640043fc9abc2c61a421ffded792 Mon Sep 17 00:00:00 2001 From: fchollet Date: Thu, 14 Apr 2016 08:32:04 -0700 Subject: [PATCH] Add set_learning_phase in TF backend. --- keras/backend/tensorflow_backend.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/keras/backend/tensorflow_backend.py b/keras/backend/tensorflow_backend.py index 32b3afa8e5e..ed2659a56ca 100644 --- a/keras/backend/tensorflow_backend.py +++ b/keras/backend/tensorflow_backend.py @@ -21,6 +21,11 @@ def learning_phase(): return _LEARNING_PHASE +def set_learning_phase(value): + global _LEARNING_PHASE + _LEARNING_PHASE = tf.constant(value, name='keras_learning_phase') + + def get_session(): '''Returns the TF session in use by the backend. '''