MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _copy

Method _copy

tensorflow/python/framework/ops.py:1013–1028  ·  view source on GitHub ↗

Copies tensor to dest device.

(self, ctx=None, device_name=None)

Source from the content-addressed store, hash-verified

1011 return new_tensor
1012
1013 def _copy(self, ctx=None, device_name=None):
1014 """Copies tensor to dest device."""
1015 new_tensor = self._copy_nograd(ctx, device_name)
1016 # Record the copy on tape and define backprop copy as well.
1017 if context.executing_eagerly():
1018 self_device = self.device
1019
1020 def grad_fun(dresult):
1021 return [
1022 dresult._copy(device_name=self_device)
1023 if hasattr(dresult, "_copy") else dresult
1024 ]
1025
1026 tape.record_operation("_copy", [new_tensor], [self], grad_fun)
1027 return new_tensor
1028 # pylint: enable=protected-access
1029
1030 @property
1031 def shape(self):

Callers 5

cpuMethod · 0.95
gpuMethod · 0.95
testGPUToRemoteCopyMethod · 0.80
grad_funMethod · 0.80

Calls 2

_copy_nogradMethod · 0.95
executing_eagerlyMethod · 0.80

Tested by 1

testGPUToRemoteCopyMethod · 0.64