From 24c75ce5016efb4ab107f27b96aac07549d8617b Mon Sep 17 00:00:00 2001 From: Hye Soo Yang Date: Thu, 14 May 2020 22:18:50 -0700 Subject: [PATCH] Addresses https://github.com/tensorflow/tensorflow/issues/38694 by ensuring TensorShape v1/v2 backwards compatibility. PiperOrigin-RevId: 311670326 Change-Id: I0e7045ff4eb19cb0096d6fa41a494c8f9a6b85c5 --- tensorflow/python/ops/image_ops_impl.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tensorflow/python/ops/image_ops_impl.py b/tensorflow/python/ops/image_ops_impl.py index e6a5cdbf4e8..52b65efad67 100644 --- a/tensorflow/python/ops/image_ops_impl.py +++ b/tensorflow/python/ops/image_ops_impl.py @@ -1231,8 +1231,10 @@ def _resize_images_common(images, resizer_fn, size, preserve_aspect_ratio, name, name='size') size_const_as_shape = tensor_util.constant_value_as_shape(size) - new_height_const = size_const_as_shape.dims[0].value - new_width_const = size_const_as_shape.dims[1].value + new_height_const = tensor_shape.dimension_at_index(size_const_as_shape, + 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 # transformation, we avoid performing the resize.