diff options
author | 2016-03-14 09:35:53 -0800 | |
---|---|---|
committer | 2016-03-14 11:46:26 -0700 | |
commit | 419a66709c2c9eab5a23ba1ba9e987b5e81b005d (patch) | |
tree | 787d2fcb143fe3886699f5081da28c83a0aa348a | |
parent | 3d965a2df83764362f37d9c33e1b9e35d65eb57f (diff) |
Eliminate now-unused pin_to_cpu code. (Legacy from before
device("/cpu:0") did the right thing when nested.)
Change: 117147187
-rw-r--r-- | tensorflow/python/client/graph_util.py | 15 | ||||
-rw-r--r-- | tensorflow/python/client/graph_util_test.py | 21 |
2 files changed, 0 insertions, 36 deletions
diff --git a/tensorflow/python/client/graph_util.py b/tensorflow/python/client/graph_util.py index 6dedcf56eb..efcd2c5fc5 100644 --- a/tensorflow/python/client/graph_util.py +++ b/tensorflow/python/client/graph_util.py @@ -143,21 +143,6 @@ def pin_variables_on_cpu(op): return device -def pin_to_cpu(op): - """Returns a CPU device for the given node.""" - device = op.device if op.device is not None else "" - dev = pydev.from_string(device) - - if not dev.device_type: - return set_cpu0(device) - if dev.device_type == "CPU": - return device - - logging.info("Operation %s has been assigned to a non-CPU (%s), so " - "it will not be pinned to the CPU.", op.name, dev.device_type) - return device - - def _node_name(n): if n.startswith("^"): return n[1:] diff --git a/tensorflow/python/client/graph_util_test.py b/tensorflow/python/client/graph_util_test.py index f97f2362db..7ecca13762 100644 --- a/tensorflow/python/client/graph_util_test.py +++ b/tensorflow/python/client/graph_util_test.py @@ -31,27 +31,6 @@ from tensorflow.python.ops import state_ops class DeviceFunctionsTest(tf.test.TestCase): - def testPinToCpu(self): - with ops.Graph().as_default() as g, g.device(graph_util.pin_to_cpu): - const_a = constant_op.constant(5.0) - const_b = constant_op.constant(10.0) - add_c = const_a + const_b - var_v = state_ops.variable_op([], dtype=dtypes.float32) - assign_c_to_v = state_ops.assign(var_v, add_c) - const_string = constant_op.constant("on a cpu") - dynamic_stitch_int_result = data_flow_ops.dynamic_stitch( - [[0, 1, 2], [2, 3]], [[12, 23, 34], [1, 2]]) - dynamic_stitch_float_result = data_flow_ops.dynamic_stitch( - [[0, 1, 2], [2, 3]], [[12.0, 23.0, 34.0], [1.0, 2.0]]) - self.assertDeviceEqual(const_a.device, "/device:CPU:0") - self.assertDeviceEqual(const_b.device, "/device:CPU:0") - self.assertDeviceEqual(add_c.device, "/device:CPU:0") - self.assertDeviceEqual(var_v.device, "/device:CPU:0") - self.assertDeviceEqual(assign_c_to_v.device, "/device:CPU:0") - self.assertDeviceEqual(const_string.device, "/device:CPU:0") - self.assertDeviceEqual(dynamic_stitch_int_result.device, "/device:CPU:0") - self.assertDeviceEqual(dynamic_stitch_float_result.device, "/device:CPU:0") - def testPinRequiredOpsOnCPU(self): with ops.Graph().as_default() as g, g.device( graph_util.pin_variables_on_cpu): |