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

Method device

tensorflow/python/eager/context.py:732–745  ·  view source on GitHub ↗

Context-manager to force placement of operations and Tensors on a device. Args: name: Name of the device or None to get default placement. Returns: Context manager that forces device placement. Raises: ValueError: If name is not a string or is an invalid device name.

(self, name)

Source from the content-addressed store, hash-verified

730 self._thread_local_data.device_spec = device_spec
731
732 def device(self, name):
733 """Context-manager to force placement of operations and Tensors on a device.
734
735 Args:
736 name: Name of the device or None to get default placement.
737
738 Returns:
739 Context manager that forces device placement.
740
741 Raises:
742 ValueError: If name is not a string or is an invalid device name.
743 RuntimeError: If device scopes are not properly nested.
744 """
745 return _EagerDeviceContext(self, name)
746
747 def devices(self):
748 """List of the names of devices available to execute operations."""

Callers 15

testContextMethod · 0.95
deviceFunction · 0.45
create_variableMethod · 0.45
testInt32CPUDefaultMethod · 0.45
_copy_non_sourceFunction · 0.45
_copy_sourceFunction · 0.45
__init__Method · 0.45
testStringTensorOnGPUMethod · 0.45
testMultiCpuPlacementMethod · 0.45

Calls 1

_EagerDeviceContextClass · 0.85

Tested by 15

testContextMethod · 0.76
create_variableMethod · 0.36
testInt32CPUDefaultMethod · 0.36
testStringTensorOnGPUMethod · 0.36
testMultiCpuPlacementMethod · 0.36
testShouldCopyMethod · 0.36
testInt32GPUMethod · 0.36
testReEntrantMethod · 0.36