diff --git a/tensorflow/python/training/saver.py b/tensorflow/python/training/saver.py index 11510d9928e..60885e92926 100644 --- a/tensorflow/python/training/saver.py +++ b/tensorflow/python/training/saver.py @@ -126,13 +126,10 @@ class BaseSaverBuilder(object): def f(): with ops.device(v.device): x = v.read_value() - # To allow variables placed on non-CPU devices to be checkpointed, - # we copy them to CPU on the same machine first. - device_spec = pydev.DeviceSpec().parse_from_string(v.device) - device_spec.merge_from( - pydev.DeviceSpec().parse_from_string("/device:CPU:0")) - with ops.device(device_spec.to_string()): - return array_ops.identity(x) + # To allow variables placed on non-CPU devices to be checkpointed, + # we copy them to CPU on the same machine first. + with ops.device("/device:CPU:0"): + return array_ops.identity(x) return f self.handle_op = var.handle