aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mark Daoust <markdaoust@google.com>2018-06-13 15:49:08 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-13 15:56:46 -0700
commit31ea26d15004a3b5ac5b87e598cd6dfdc71f6012 (patch)
tree968f4c50fcd838239ac24a0d769a72b97a53f37c
parent02c74ef9bf6108440c31332a9116eb6c0340e06e (diff)
Fix `Input` to allow scalar shape.
The primary use-case is for models that include their pre-processing, and expect a batch of strings as input (like most of the tensorflow_hub text modules). In python the empty tuple (a scalar-shape) is Falsey. This change avoids the "ValueError please provide a `tensor` or `shape`" error when the user provides an empty shape. PiperOrigin-RevId: 200467536
-rw-r--r--tensorflow/python/keras/engine/input_layer.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tensorflow/python/keras/engine/input_layer.py b/tensorflow/python/keras/engine/input_layer.py
index 7996110829..8a4018a0df 100644
--- a/tensorflow/python/keras/engine/input_layer.py
+++ b/tensorflow/python/keras/engine/input_layer.py
@@ -215,7 +215,7 @@ def Input( # pylint: disable=invalid-name
if dtype is None:
dtype = K.floatx()
- if not shape and tensor is None:
+ if shape is None and tensor is None:
raise ValueError('Please provide to Input either a `shape`'
' or a `tensor` argument. Note that '
'`shape` does not include the batch '