diff options
author | 2018-05-16 18:03:01 -0700 | |
---|---|---|
committer | 2018-05-16 18:06:14 -0700 | |
commit | 0c33e1ff58e121a0cf6acdb6aeb8de53cb3abf25 (patch) | |
tree | 42d8a74609e78bffda238c3f8f0538bfdf61a80c /tensorflow/python/client | |
parent | 1511cf2f51965151147d1ca2e822439c6656b821 (diff) |
Remove _USE_C_API staging in tests now that the C API is enabled by default.
This is in preparation for removing the _USE_C_API toggle altogether.
PiperOrigin-RevId: 196920481
Diffstat (limited to 'tensorflow/python/client')
-rw-r--r-- | tensorflow/python/client/session_clusterspec_prop_test.py | 4 | ||||
-rw-r--r-- | tensorflow/python/client/session_list_devices_test.py | 31 | ||||
-rw-r--r-- | tensorflow/python/client/session_partial_run_test.py | 29 | ||||
-rw-r--r-- | tensorflow/python/client/session_test.py | 21 | ||||
-rw-r--r-- | tensorflow/python/client/virtual_gpu_test.py | 1 |
5 files changed, 4 insertions, 82 deletions
diff --git a/tensorflow/python/client/session_clusterspec_prop_test.py b/tensorflow/python/client/session_clusterspec_prop_test.py index f193424133..df020f88a8 100644 --- a/tensorflow/python/client/session_clusterspec_prop_test.py +++ b/tensorflow/python/client/session_clusterspec_prop_test.py @@ -42,7 +42,6 @@ from tensorflow.python.platform import googletest from tensorflow.python.platform import test from tensorflow.python.training import server_lib -ops._USE_C_API = True # NOTE(mrry): Dummy shape registration for ops used in the tests, since they # don't have C++ op registrations on which to attach C++ shape fns. @@ -77,7 +76,7 @@ class SessionClusterSpecPropagationTest(test_util.TensorFlowTestCase): config = config_pb2.ConfigProto(cluster_def=cluster_def) with ops.Graph().as_default() as g, ops.device('/job:worker/task:1'): - with ops.device('/cpu:0'): + with ops.device('/cpu:0'): const = constant_op.constant(17) sess = session.Session(server1.target, config=config, graph=g) run_options = config_pb2.RunOptions( @@ -459,7 +458,6 @@ class SessionClusterSpecPropagationTest(test_util.TensorFlowTestCase): with self.assertRaises(errors.FailedPreconditionError): sess3.run(v) - @test_util.disable_c_api # Partial runs don't work with C API def testClusterSpecPropagationPartialRun(self): """Test successful partial run with ClusterSpec propagation.""" server1 = server_lib.Server.create_local_server() diff --git a/tensorflow/python/client/session_list_devices_test.py b/tensorflow/python/client/session_list_devices_test.py index 38a3acb2dc..c5d82c213a 100644 --- a/tensorflow/python/client/session_list_devices_test.py +++ b/tensorflow/python/client/session_list_devices_test.py @@ -30,8 +30,7 @@ from tensorflow.python.platform import googletest from tensorflow.python.training import server_lib -class SessionListDevicesTestMethods(object): - """Mixin with test methods.""" +class SessionListDevicesTest(test_util.TensorFlowTestCase): def testListDevices(self): with session.Session() as sess: @@ -75,33 +74,5 @@ class SessionListDevicesTestMethods(object): '/job:worker/replica:0/task:1/device:CPU:0' in device_names) -class SessionListDevicesTest(SessionListDevicesTestMethods, - test_util.TensorFlowTestCase): - """Test case that invokes test methods with _USE_C_API=False.""" - - def setUp(self): - self.prev_use_c_api = ops._USE_C_API - ops._USE_C_API = False - super(SessionListDevicesTest, self).setUp() - - def tearDown(self): - ops._USE_C_API = self.prev_use_c_api - super(SessionListDevicesTest, self).tearDown() - - -class SessionListDevicesWithCApiTest(SessionListDevicesTestMethods, - test_util.TensorFlowTestCase): - """Test case that invokes test methods with _USE_C_API=True.""" - - def setUp(self): - self.prev_use_c_api = ops._USE_C_API - ops._USE_C_API = True - super(SessionListDevicesWithCApiTest, self).setUp() - - def tearDown(self): - ops._USE_C_API = self.prev_use_c_api - super(SessionListDevicesWithCApiTest, self).tearDown() - - if __name__ == '__main__': googletest.main() diff --git a/tensorflow/python/client/session_partial_run_test.py b/tensorflow/python/client/session_partial_run_test.py index 6a389b078a..92ca47efa9 100644 --- a/tensorflow/python/client/session_partial_run_test.py +++ b/tensorflow/python/client/session_partial_run_test.py @@ -39,7 +39,7 @@ from tensorflow.python.training import server_lib ops.RegisterShape('ConstructionFails')(common_shapes.unknown_shape) -class PartialRunTestMethods(object): +class PartialRunTest(test_util.TensorFlowTestCase): def RunTestPartialRun(self, sess): a = array_ops.placeholder(dtypes.float32, shape=[]) @@ -283,32 +283,5 @@ class PartialRunTestMethods(object): self.RunTestPartialRunEmptyFetches(session.Session(server.target)) -class PartialRunTest(PartialRunTestMethods, test_util.TensorFlowTestCase): - """Test case that invokes test methods with _USE_C_API=False.""" - - def setUp(self): - self.prev_use_c_api = ops._USE_C_API - ops._USE_C_API = False - super(PartialRunTest, self).setUp() - - def tearDown(self): - ops._USE_C_API = self.prev_use_c_api - super(PartialRunTest, self).tearDown() - - -class PartialRunWithCApiTest(PartialRunTestMethods, - test_util.TensorFlowTestCase): - """Test case that invokes test methods with _USE_C_API=True.""" - - def setUp(self): - self.prev_use_c_api = ops._USE_C_API - ops._USE_C_API = True - super(PartialRunWithCApiTest, self).setUp() - - def tearDown(self): - ops._USE_C_API = self.prev_use_c_api - super(PartialRunWithCApiTest, self).tearDown() - - if __name__ == '__main__': googletest.main() diff --git a/tensorflow/python/client/session_test.py b/tensorflow/python/client/session_test.py index 92497272c6..e9a7d9ac1d 100644 --- a/tensorflow/python/client/session_test.py +++ b/tensorflow/python/client/session_test.py @@ -62,7 +62,6 @@ from tensorflow.python.util import compat ops.RegisterShape('ConstructionFails')(common_shapes.unknown_shape) -@test_util.with_c_api class SessionTest(test_util.TensorFlowTestCase): def setUp(self): @@ -173,21 +172,6 @@ class SessionTest(test_util.TensorFlowTestCase): # Run with a bogus handle. s.partial_run('foo', r1, feed_dict={a: 1, b: 2}) - def testOpConstructionErrorPayload(self): - if ops._USE_C_API: - return # No shape registration for 'ConstructionFails' - - with session.Session(): - failing_op = ops.get_default_graph().create_op( - 'ConstructionFails', [], [], name='f') - - def exc_predicate(e): - return (e.op == failing_op and - e.error_code == error_codes_pb2.INVALID_ARGUMENT) - - with self.assertRaisesOpError(exc_predicate): - failing_op.run() - def testErrorBasedOn(self): with session.Session() as sess: a = constant_op.constant(0.0, shape=[2, 3]) @@ -1084,10 +1068,7 @@ class SessionTest(test_util.TensorFlowTestCase): if gdef is None: gdef = graph.as_graph_def() else: - # NOTE(skyewm): import_graph_def breaks the running threads without - # the C API enabled. This is not a regression so I didn't fix it. - if ops._USE_C_API: - importer.import_graph_def(gdef, name='import') + importer.import_graph_def(gdef, name='import') stop.set() for t in threads: diff --git a/tensorflow/python/client/virtual_gpu_test.py b/tensorflow/python/client/virtual_gpu_test.py index ae653e03dd..52e1b56886 100644 --- a/tensorflow/python/client/virtual_gpu_test.py +++ b/tensorflow/python/client/virtual_gpu_test.py @@ -192,7 +192,6 @@ class VirtualGpuTestUtil(object): return True -@test_util.with_c_api class VirtualGpuTest(test_util.TensorFlowTestCase): def __init__(self, method_name): |