Addresses https://github.com/tensorflow/tensorflow/issues/38694 by ensuring TensorShape v1/v2 backwards compatibility.

PiperOrigin-RevId: 311670326
Change-Id: I0e7045ff4eb19cb0096d6fa41a494c8f9a6b85c5
This commit is contained in:
Hye Soo Yang 2020-05-14 22:18:50 -07:00 committed by TensorFlower Gardener
parent 28899d991f
commit 24c75ce501
1 changed files with 4 additions and 2 deletions

View File

@ -1231,8 +1231,10 @@ def _resize_images_common(images, resizer_fn, size, preserve_aspect_ratio, name,
name='size') name='size')
size_const_as_shape = tensor_util.constant_value_as_shape(size) size_const_as_shape = tensor_util.constant_value_as_shape(size)
new_height_const = size_const_as_shape.dims[0].value new_height_const = tensor_shape.dimension_at_index(size_const_as_shape,
new_width_const = size_const_as_shape.dims[1].value 0).value
new_width_const = tensor_shape.dimension_at_index(size_const_as_shape,
1).value
# If we can determine that the height and width will be unmodified by this # If we can determine that the height and width will be unmodified by this
# transformation, we avoid performing the resize. # transformation, we avoid performing the resize.