aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/ops/image_ops_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/python/ops/image_ops_test.py')
-rw-r--r--tensorflow/python/ops/image_ops_test.py42
1 files changed, 16 insertions, 26 deletions
diff --git a/tensorflow/python/ops/image_ops_test.py b/tensorflow/python/ops/image_ops_test.py
index b12bd3d5b0..18625293e0 100644
--- a/tensorflow/python/ops/image_ops_test.py
+++ b/tensorflow/python/ops/image_ops_test.py
@@ -1869,8 +1869,8 @@ class SelectDistortedCropBoxTest(test_util.TensorFlowTestCase):
image_size = constant_op.constant(
[40, 50, 1], shape=[3], dtype=dtypes.int32)
bounding_box = constant_op.constant(
- [0.0, 0.0, 1.0, 1.0],
- shape=[4],
+ [[[0.0, 0.0, 1.0, 1.0]]],
+ shape=[1, 1, 4],
dtype=dtypes.float32,
)
begin, end, bbox_for_drawing = image_ops.sample_distorted_bounding_box(
@@ -1884,6 +1884,10 @@ class SelectDistortedCropBoxTest(test_util.TensorFlowTestCase):
self.assertAllEqual([3], begin.get_shape().as_list())
self.assertAllEqual([3], end.get_shape().as_list())
self.assertAllEqual([1, 1, 4], bbox_for_drawing.get_shape().as_list())
+ # Actual run to make sure shape is correct inside Compute().
+ begin = begin.eval()
+ end = end.eval()
+ bbox_for_drawing = bbox_for_drawing.eval()
begin, end, bbox_for_drawing = image_ops.sample_distorted_bounding_box(
image_size=image_size,
@@ -1903,8 +1907,8 @@ class SelectDistortedCropBoxTest(test_util.TensorFlowTestCase):
image_size = constant_op.constant(
[40, 50, 1], shape=[3], dtype=dtypes.int32)
bounding_box = constant_op.constant(
- [0.0, 0.0, 1.0, 1.0],
- shape=[4],
+ [[[0.0, 0.0, 1.0, 1.0]]],
+ shape=[1, 1, 4],
dtype=dtypes.float32,
)
begin, end, bbox_for_drawing = image_ops.sample_distorted_bounding_box(
@@ -1916,6 +1920,10 @@ class SelectDistortedCropBoxTest(test_util.TensorFlowTestCase):
self.assertAllEqual([3], begin.get_shape().as_list())
self.assertAllEqual([3], end.get_shape().as_list())
self.assertAllEqual([1, 1, 4], bbox_for_drawing.get_shape().as_list())
+ # Actual run to make sure shape is correct inside Compute().
+ begin = begin.eval()
+ end = end.eval()
+ bbox_for_drawing = bbox_for_drawing.eval()
class ResizeImagesTest(test_util.TensorFlowTestCase):
@@ -2822,20 +2830,9 @@ class PngTest(test_util.TensorFlowTestCase):
class GifTest(test_util.TensorFlowTestCase):
- def testOptimizedGifErrorString(self):
- filename = "tensorflow/core/lib/gif/testdata/optimized.gif"
-
- with self.test_session(use_gpu=True) as sess:
- gif = io_ops.read_file(filename)
- image = image_ops.decode_gif(gif)
- with self.assertRaisesRegexp(errors.InvalidArgumentError,
- "can't process optimized gif"):
- gif, image = sess.run([gif, image])
-
- def testValid(self):
+ def _testValid(self, filename):
# Read some real GIFs
prefix = "tensorflow/core/lib/gif/testdata/"
- filename = "scan.gif"
WIDTH = 20
HEIGHT = 40
STRIDE = 5
@@ -2862,16 +2859,9 @@ class GifTest(test_util.TensorFlowTestCase):
self.assertAllClose(frame, gt)
- def testInValid(self):
- # Read some real GIFs
- prefix = "tensorflow/core/lib/gif/testdata/"
- filename = "optimized.gif"
-
- with self.test_session(use_gpu=True) as sess:
- gif0 = io_ops.read_file(prefix + filename)
- image0 = image_ops.decode_gif(gif0)
- with self.assertRaises(errors.InvalidArgumentError):
- gif0, image0 = sess.run([gif0, image0])
+ def testValid(self):
+ self._testValid("scan.gif")
+ self._testValid("optimized.gif")
def testShape(self):
with self.test_session(use_gpu=True) as sess: