From 966ec311d18c8dd7ec4194d53488487691e7b296 Mon Sep 17 00:00:00 2001 From: Daniel Seichter Date: Mon, 13 Mar 2017 21:51:28 +0100 Subject: [PATCH] Fix learning_phase int check (#5749) --- keras/engine/training.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/keras/engine/training.py b/keras/engine/training.py index c5c6f98ed..ce8d01a46 100644 --- a/keras/engine/training.py +++ b/keras/engine/training.py @@ -1518,7 +1518,7 @@ class Model(Container): check_batch_axis=False, batch_size=batch_size) # prepare inputs, delegate logic to _test_loop - if self.uses_learning_phase and not isinstance(K.learning_phase, int): + if self.uses_learning_phase and not isinstance(K.learning_phase(), int): ins = x + y + sample_weights + [0.] else: ins = x + y + sample_weights @@ -1562,7 +1562,7 @@ class Model(Container): 'Batch size: ' + str(batch_size) + '.') # prepare inputs, delegate logic to _predict_loop - if self.uses_learning_phase and not isinstance(K.learning_phase, int): + if self.uses_learning_phase and not isinstance(K.learning_phase(), int): ins = x + [0.] else: ins = x @@ -1612,7 +1612,7 @@ class Model(Container): sample_weight=sample_weight, class_weight=class_weight, check_batch_axis=True) - if self.uses_learning_phase and not isinstance(K.learning_phase, int): + if self.uses_learning_phase and not isinstance(K.learning_phase(), int): ins = x + y + sample_weights + [1.] else: ins = x + y + sample_weights @@ -1654,7 +1654,7 @@ class Model(Container): x, y, sample_weight=sample_weight, check_batch_axis=True) - if self.uses_learning_phase and not isinstance(K.learning_phase, int): + if self.uses_learning_phase and not isinstance(K.learning_phase(), int): ins = x + y + sample_weights + [0.] else: ins = x + y + sample_weights @@ -1675,7 +1675,7 @@ class Model(Container): """ x = _standardize_input_data(x, self._feed_input_names, self._feed_input_shapes) - if self.uses_learning_phase and not isinstance(K.learning_phase, int): + if self.uses_learning_phase and not isinstance(K.learning_phase(), int): ins = x + [0.] else: ins = x