Fixing / disabling a few tests failing when we run with TF v2. This change is
mostly the same as #31386/commits/4de05d7afdce730c3fee0ec4aa031caa52fa82c2 but the latter also removes contrib from pip_smoke_test which has already been done. PiperOrigin-RevId: 269683160
This commit is contained in:
parent
d44f3a37ec
commit
290f1571a5
@ -27,7 +27,7 @@ class FactTest(tf.test.TestCase):
|
|||||||
@test_util.run_deprecated_v1
|
@test_util.run_deprecated_v1
|
||||||
def test(self):
|
def test(self):
|
||||||
with self.cached_session():
|
with self.cached_session():
|
||||||
print(tf.user_ops.my_fact().eval())
|
print(tf.compat.v1.user_ops.my_fact().eval())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -48,7 +48,8 @@ class ZeroOut1Test(tf.test.TestCase):
|
|||||||
|
|
||||||
def testLoadTwice(self):
|
def testLoadTwice(self):
|
||||||
zero_out_loaded_again = tf.load_op_library(os.path.join(
|
zero_out_loaded_again = tf.load_op_library(os.path.join(
|
||||||
tf.resource_loader.get_data_files_path(), 'zero_out_op_kernel_1.so'))
|
tf.compat.v1.resource_loader.get_data_files_path(),
|
||||||
|
'zero_out_op_kernel_1.so'))
|
||||||
self.assertEqual(zero_out_loaded_again, zero_out_op_1._zero_out_module)
|
self.assertEqual(zero_out_loaded_again, zero_out_op_1._zero_out_module)
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class ZeroOut2Test(tf.test.TestCase):
|
|||||||
shape = (5,)
|
shape = (5,)
|
||||||
x = tf.constant([5, 4, 3, 2, 1], dtype=tf.float32)
|
x = tf.constant([5, 4, 3, 2, 1], dtype=tf.float32)
|
||||||
y = zero_out_op_2.zero_out(x)
|
y = zero_out_op_2.zero_out(x)
|
||||||
err = tf.test.compute_gradient_error(x, shape, y, shape)
|
err = tf.compat.v1.test.compute_gradient_error(x, shape, y, shape)
|
||||||
self.assertLess(err, 1e-4)
|
self.assertLess(err, 1e-4)
|
||||||
|
|
||||||
@test_util.run_deprecated_v1
|
@test_util.run_deprecated_v1
|
||||||
@ -56,7 +56,7 @@ class ZeroOut2Test(tf.test.TestCase):
|
|||||||
shape = (2, 3)
|
shape = (2, 3)
|
||||||
x = tf.constant([[6, 5, 4], [3, 2, 1]], dtype=tf.float32)
|
x = tf.constant([[6, 5, 4], [3, 2, 1]], dtype=tf.float32)
|
||||||
y = zero_out_op_2.zero_out(x)
|
y = zero_out_op_2.zero_out(x)
|
||||||
err = tf.test.compute_gradient_error(x, shape, y, shape)
|
err = tf.compat.v1.test.compute_gradient_error(x, shape, y, shape)
|
||||||
self.assertLess(err, 1e-4)
|
self.assertLess(err, 1e-4)
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import os.path
|
|||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
|
|
||||||
_zero_out_module = tf.load_op_library(
|
_zero_out_module = tf.load_op_library(
|
||||||
os.path.join(tf.resource_loader.get_data_files_path(),
|
os.path.join(tf.compat.v1.resource_loader.get_data_files_path(),
|
||||||
'zero_out_op_kernel_1.so'))
|
'zero_out_op_kernel_1.so'))
|
||||||
zero_out = _zero_out_module.zero_out
|
zero_out = _zero_out_module.zero_out
|
||||||
namespace_zero_out = _zero_out_module.namespace_zero_out
|
namespace_zero_out = _zero_out_module.namespace_zero_out
|
||||||
|
@ -22,7 +22,7 @@ import os.path
|
|||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
|
|
||||||
_zero_out_module = tf.load_op_library(
|
_zero_out_module = tf.load_op_library(
|
||||||
os.path.join(tf.resource_loader.get_data_files_path(),
|
os.path.join(tf.compat.v1.resource_loader.get_data_files_path(),
|
||||||
'zero_out_op_kernel_2.so'))
|
'zero_out_op_kernel_2.so'))
|
||||||
zero_out = _zero_out_module.zero_out
|
zero_out = _zero_out_module.zero_out
|
||||||
zero_out2 = _zero_out_module.zero_out2
|
zero_out2 = _zero_out_module.zero_out2
|
||||||
|
@ -22,6 +22,6 @@ import os.path
|
|||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
|
|
||||||
_zero_out_module = tf.load_op_library(
|
_zero_out_module = tf.load_op_library(
|
||||||
os.path.join(tf.resource_loader.get_data_files_path(),
|
os.path.join(tf.compat.v1.resource_loader.get_data_files_path(),
|
||||||
'zero_out_op_kernel_3.so'))
|
'zero_out_op_kernel_3.so'))
|
||||||
zero_out = _zero_out_module.zero_out
|
zero_out = _zero_out_module.zero_out
|
||||||
|
@ -62,6 +62,7 @@ tf_py_test(
|
|||||||
],
|
],
|
||||||
tags = [
|
tags = [
|
||||||
"no_pip", # b/131330719
|
"no_pip", # b/131330719
|
||||||
|
"v1only", # uses contrib
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -98,6 +99,7 @@ tf_py_test(
|
|||||||
],
|
],
|
||||||
tags = [
|
tags = [
|
||||||
"no_pip", # b/131330719
|
"no_pip", # b/131330719
|
||||||
|
"v1only", # uses contrib
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -144,6 +146,7 @@ tf_py_test(
|
|||||||
],
|
],
|
||||||
tags = [
|
tags = [
|
||||||
"no_pip", # b/131330719
|
"no_pip", # b/131330719
|
||||||
|
"v1only", # uses contrib
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -187,6 +190,7 @@ tf_py_test(
|
|||||||
],
|
],
|
||||||
tags = [
|
tags = [
|
||||||
"no_pip", # b/131330719
|
"no_pip", # b/131330719
|
||||||
|
"v1only", # uses contrib
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -230,6 +234,7 @@ tf_py_test(
|
|||||||
],
|
],
|
||||||
tags = [
|
tags = [
|
||||||
"no_pip", # b/131330719
|
"no_pip", # b/131330719
|
||||||
|
"v1only", # uses contrib
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -284,6 +289,7 @@ tf_py_test(
|
|||||||
],
|
],
|
||||||
tags = [
|
tags = [
|
||||||
"no_pip", # b/131330719
|
"no_pip", # b/131330719
|
||||||
|
"v1only", # uses contrib
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user