Remove @test_util.run_deprecated_v1 in reshape_op_test.py

PiperOrigin-RevId: 324090913
Change-Id: If8105bddba9b3857a53b8288aa3d1b6ae1a55419
This commit is contained in:
Kibeom Kim 2020-07-30 15:02:41 -07:00 committed by TensorFlower Gardener
parent e321e00f43
commit 5f68356af4

View File

@ -26,7 +26,7 @@ from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from tensorflow.python.framework import test_util
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import gradient_checker
from tensorflow.python.ops import gradient_checker_v2
from tensorflow.python.platform import test
@ -118,17 +118,15 @@ class ReshapeTest(test.TestCase):
# TODO(vrv): Add tests for failure conditions once python test_util
# reports errors.
@test_util.run_deprecated_v1
def testFloatReshapeGradThreeDimensions(self):
x = np.arange(1., 25.).reshape([2, 3, 4]).astype(np.float32)
s = list(np.shape(x))
with self.cached_session():
input_tensor = constant_op.constant(x)
reshape_out = array_ops.reshape(input_tensor, [1, 8, 3])
err = gradient_checker.compute_gradient_error(
input_tensor, s, reshape_out, s, x_init_value=x)
print("Reshape gradient error = " % err)
self.assertLess(err, 1e-3)
def reshape(x):
return array_ops.reshape(x, [1, 8, 3])
with self.cached_session():
gradient_checker_v2.compute_gradient(reshape, [input_tensor], 1e-3)
def testFloatEmpty(self):
x = np.empty((0, 0, 0, 0), dtype=np.float32)
@ -157,8 +155,10 @@ class ReshapeTest(test.TestCase):
"Cannot reshape a tensor with 4096 elements"):
array_ops.reshape(z, [4095])
@test_util.run_deprecated_v1
def testPartialShapes(self):
# Testing unknown shapes in graph building.
with ops.Graph().as_default():
x = array_ops.placeholder(dtypes.float32)
# Unknown input shape, partial new shape.