MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / testSumTensor

Method testSumTensor

tensorflow/python/ops/image_ops_test.py:2966–2990  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2964
2965 @test_util.disable_xla("align_corners=False not supported by XLA")
2966 def testSumTensor(self):
2967 img_shape = [1, 6, 4, 1]
2968 # This test is also conducted with int8, so 127 is the maximum
2969 # value that can be used.
2970 data = [
2971 127, 127, 64, 64, 127, 127, 64, 64, 64, 64, 127, 127, 64, 64, 127, 127,
2972 50, 50, 100, 100, 50, 50, 100, 100
2973 ]
2974 # Test size where width is specified as a tensor which is a sum
2975 # of two tensors.
2976 width_1 = constant_op.constant(1)
2977 width_2 = constant_op.constant(3)
2978 width = math_ops.add(width_1, width_2)
2979 height = constant_op.constant(6)
2980
2981 img_np = np.array(data, dtype=np.uint8).reshape(img_shape)
2982
2983 for method in self.METHODS:
2984 with self.cached_session() as sess:
2985 image = constant_op.constant(img_np, shape=img_shape)
2986 y = image_ops.resize_images(image, [height, width], method)
2987 yshape = array_ops.shape(y)
2988 resized, newshape = self.evaluate([y, yshape])
2989 self.assertAllEqual(img_shape, newshape)
2990 self.assertAllClose(resized, img_np, atol=1e-5)
2991
2992 @test_util.disable_xla("align_corners=False not supported by XLA")
2993 def testResizeDown(self):

Callers

nothing calls this directly

Calls 8

reshapeMethod · 0.80
constantMethod · 0.45
addMethod · 0.45
cached_sessionMethod · 0.45
shapeMethod · 0.45
evaluateMethod · 0.45
assertAllEqualMethod · 0.45
assertAllCloseMethod · 0.45

Tested by

no test coverage detected