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

Method list_physical_devices

tensorflow/python/eager/context.py:1071–1092  ·  view source on GitHub ↗

List local devices visible to the system. This API allows a client to query the devices before they have been initialized by the eager runtime. Additionally a user can filter by device type, to get only CPUs or GPUs. Args: device_type: Optional device type to limit results to

(self, device_type=None)

Source from the content-addressed store, hash-verified

1069 self._import_config()
1070
1071 def list_physical_devices(self, device_type=None):
1072 """List local devices visible to the system.
1073
1074 This API allows a client to query the devices before they have been
1075 initialized by the eager runtime. Additionally a user can filter by device
1076 type, to get only CPUs or GPUs.
1077
1078 Args:
1079 device_type: Optional device type to limit results to
1080
1081 Returns:
1082 List of PhysicalDevice objects.
1083 """
1084 self._initialize_physical_devices()
1085
1086 if device_type is not None:
1087 return [
1088 d for d in self._physical_devices
1089 if device_type is None or device_type == d.device_type
1090 ]
1091
1092 return self._physical_devices
1093
1094 def _import_config(self):
1095 """Import config if passed in during construction.

Callers 15

_compute_gpu_optionsMethod · 0.95
list_physical_devicesFunction · 0.80
testPhysicalDevicesMethod · 0.80
testCpuMultipleMethod · 0.80
testGpuNoneMethod · 0.80
testGpuMultipleMethod · 0.80
testVirtualGpuMethod · 0.80
testGpuGrowthMethod · 0.80
testGpuInvalidConfigMethod · 0.80
testV1CompatibilityMethod · 0.80

Calls 1

Tested by 15

testPhysicalDevicesMethod · 0.64
testCpuMultipleMethod · 0.64
testGpuNoneMethod · 0.64
testGpuMultipleMethod · 0.64
testVirtualGpuMethod · 0.64
testGpuGrowthMethod · 0.64
testGpuInvalidConfigMethod · 0.64
testV1CompatibilityMethod · 0.64
configure_virtual_cpusFunction · 0.64
setUpMethod · 0.64
setUpMethod · 0.64