diff options
author | 2016-07-01 11:55:31 -0700 | |
---|---|---|
committer | 2016-07-01 11:55:31 -0700 | |
commit | 06fca4d9bc7ebff88493e105e4a1fe5002616469 (patch) | |
tree | e717d6a2e26d71455b0be40deedb1c11ab1eba0b /tensorflow/python/ops/array_ops.py | |
parent | 1c9e73a7a54413e205c9d0b127c61f0cb1adda34 (diff) | |
parent | de32f9237b5958f7a6951e79f2649572d29a1980 (diff) |
Merge pull request #3151 from rmlarsen/branch_126416482
Branch 126416482
Diffstat (limited to 'tensorflow/python/ops/array_ops.py')
-rw-r--r-- | tensorflow/python/ops/array_ops.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tensorflow/python/ops/array_ops.py b/tensorflow/python/ops/array_ops.py index 509f627170..658844dfb3 100644 --- a/tensorflow/python/ops/array_ops.py +++ b/tensorflow/python/ops/array_ops.py @@ -1835,16 +1835,16 @@ def _FillShape(op): Returns: A single-element list containing the shape of the output. + + Raises: + ValueError: If the shapes or arguments are known to be invalid. """ - dimensions_shape = op.inputs[0].get_shape().with_rank(1) - op.inputs[1].get_shape().assert_is_compatible_with(tensor_shape.scalar()) + op.inputs[0].get_shape().assert_has_rank(1) + op.inputs[1].get_shape().assert_has_rank(0) fill_dims = tensor_util.constant_value(op.inputs[0]) - if fill_dims is None: - # Attempt to infer the rank of the output from the length of - # dimensions. - return [tensor_shape.unknown_shape(ndims=dimensions_shape[0].value)] - else: - return [tensor_shape.TensorShape(fill_dims.tolist())] + if fill_dims is not None and any(d < 0 for d in fill_dims): + raise ValueError("Fill dimensions must be >= 0") + return [tensor_util.constant_value_as_shape(op.inputs[0])] @ops.RegisterShape("InvertPermutation") |