Update tensor copying to reference TF2 APIs.
PiperOrigin-RevId: 252992184
This commit is contained in:
parent
b11313feca
commit
16b680525b
@ -125,12 +125,11 @@ Status MaybeCopyInputToExpectedDevice(EagerOperation* op,
|
||||
expected_input_device->name(), " but is actually on ",
|
||||
actual_device->name(), " (operation running on ", op_device_name,
|
||||
")",
|
||||
" Tensors can be copied explicitly using .gpu() or .cpu() "
|
||||
"methods,"
|
||||
" or transparently copied by using tf.enable_eager_execution("
|
||||
"device_policy=tfe.DEVICE_PLACEMENT_SILENT). Copying tensors "
|
||||
"between devices"
|
||||
" may slow down your model");
|
||||
" Tensors can be copied explicitly using:"
|
||||
" `with tf.device(device_name): x = tf.identity(x)`"
|
||||
" or transparently copied by using"
|
||||
" tf.config.experimental.set_device_policy('silent')."
|
||||
" Copying tensors between devices may slow down your model");
|
||||
case DEVICE_PLACEMENT_WARN:
|
||||
LOG(WARNING) << "before computing " << op->Name() << " input #" << i
|
||||
<< " was expected to be on "
|
||||
|
@ -951,10 +951,12 @@ class _EagerTensorBase(Tensor):
|
||||
"""
|
||||
return self._copy_nograd(context.context(), "CPU:0")
|
||||
|
||||
@deprecation.deprecated(None, "Use tf.identity instead.")
|
||||
def cpu(self):
|
||||
"""A copy of this Tensor with contents backed by host memory."""
|
||||
return self._copy(context.context(), "CPU:0")
|
||||
|
||||
@deprecation.deprecated(None, "Use tf.identity instead.")
|
||||
def gpu(self, gpu_index=0):
|
||||
"""A copy of this Tensor with contents backed by memory on the GPU.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user