(self)
| 2848 | @test_util.disable_xla("align_corners=False not supported by XLA") |
| 2849 | @test_util.run_deprecated_v1 |
| 2850 | def testNoOp(self): |
| 2851 | img_shape = [1, 6, 4, 1] |
| 2852 | single_shape = [6, 4, 1] |
| 2853 | # This test is also conducted with int8, so 127 is the maximum |
| 2854 | # value that can be used. |
| 2855 | data = [ |
| 2856 | 127, 127, 64, 64, 127, 127, 64, 64, 64, 64, 127, 127, 64, 64, 127, 127, |
| 2857 | 50, 50, 100, 100, 50, 50, 100, 100 |
| 2858 | ] |
| 2859 | target_height = 6 |
| 2860 | target_width = 4 |
| 2861 | |
| 2862 | for nptype in self.TYPES: |
| 2863 | img_np = np.array(data, dtype=nptype).reshape(img_shape) |
| 2864 | |
| 2865 | for method in self.METHODS: |
| 2866 | with self.cached_session(use_gpu=True) as sess: |
| 2867 | image = constant_op.constant(img_np, shape=img_shape) |
| 2868 | y = image_ops.resize_images(image, [target_height, target_width], |
| 2869 | method) |
| 2870 | yshape = array_ops.shape(y) |
| 2871 | resized, newshape = self.evaluate([y, yshape]) |
| 2872 | self.assertAllEqual(img_shape, newshape) |
| 2873 | self.assertAllClose(resized, img_np, atol=1e-5) |
| 2874 | |
| 2875 | # Resizing with a single image must leave the shape unchanged also. |
| 2876 | with self.cached_session(use_gpu=True): |
| 2877 | img_single = img_np.reshape(single_shape) |
| 2878 | image = constant_op.constant(img_single, shape=single_shape) |
| 2879 | y = image_ops.resize_images(image, [target_height, target_width], |
| 2880 | self.METHODS[0]) |
| 2881 | yshape = array_ops.shape(y) |
| 2882 | newshape = self.evaluate(yshape) |
| 2883 | self.assertAllEqual(single_shape, newshape) |
| 2884 | |
| 2885 | @test_util.run_deprecated_v1 |
| 2886 | def testTensorArguments(self): |
nothing calls this directly
no test coverage detected