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

Function list_physical_devices

tensorflow/python/framework/config.py:364–385  ·  view source on GitHub ↗

Return a list of physical devices visible to the runtime. Physical devices are hardware devices locally present on the current machine. By default all discovered CPU and GPU devices are considered visible. The `list_physical_devices` allows querying the hardware prior to runtime initializat

(device_type=None)

Source from the content-addressed store, hash-verified

362
363@tf_export('config.experimental.list_physical_devices')
364def list_physical_devices(device_type=None):
365 """Return a list of physical devices visible to the runtime.
366
367 Physical devices are hardware devices locally present on the current machine.
368 By default all discovered CPU and GPU devices are considered visible. The
369 `list_physical_devices` allows querying the hardware prior to runtime
370 initialization.
371
372 The following example ensures the machine can see at least 1 GPU.
373
374 ```python
375 physical_devices = tf.config.experimental.list_physical_devices('GPU')
376 assert len(physical_devices) > 0, "No GPUs found."
377 ```
378
379 Args:
380 device_type: (optional) Device type to filter by such as "CPU" or "GPU"
381
382 Returns:
383 List of PhysicalDevice objects
384 """
385 return context.context().list_physical_devices(device_type)
386
387
388@tf_export('config.experimental.list_logical_devices')

Callers

nothing calls this directly

Calls 2

list_physical_devicesMethod · 0.80
contextMethod · 0.45

Tested by

no test coverage detected