aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-06-04 12:15:47 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-04 12:18:38 -0700
commitd88e8719833b409042c03d20a9a4acaac1d1f531 (patch)
tree8295878a8c582416e347aa3d05dc4152a4d4b315
parentd16877ce0372df0c1ff5b8046fbe8985cfb796f9 (diff)
added clearer description for invalid behavior when executing in eager mode.
PiperOrigin-RevId: 199173022
-rw-r--r--tensorflow/python/keras/engine/input_layer.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tensorflow/python/keras/engine/input_layer.py b/tensorflow/python/keras/engine/input_layer.py
index b04dc3c60b..7996110829 100644
--- a/tensorflow/python/keras/engine/input_layer.py
+++ b/tensorflow/python/keras/engine/input_layer.py
@@ -119,6 +119,12 @@ class InputLayer(base_layer.Layer):
self.is_placeholder = False
self._batch_input_shape = tuple(input_tensor.get_shape().as_list())
+ if context.executing_eagerly():
+ raise ValueError('You should not pass an input tensor when executing '
+ 'in eager mode. For example, instead of creating an '
+ 'InputLayer, you should instantiate your model and '
+ 'directly call it on your input.')
+
# Create an input node to add to self.outbound_node
# and set output_tensors' _keras_history.
input_tensor._keras_history = (self, 0, 0) # pylint: disable=protected-access