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

Function _get_available_gpus

tensorflow/python/keras/backend.py:619–632  ·  view source on GitHub ↗

Get a list of available gpu devices (formatted as strings). Returns: A list of available GPU devices.

()

Source from the content-addressed store, hash-verified

617
618
619def _get_available_gpus():
620 """Get a list of available gpu devices (formatted as strings).
621
622 Returns:
623 A list of available GPU devices.
624 """
625 if ops.executing_eagerly_outside_functions():
626 # Returns names of devices directly.
627 return [name for name in context.list_devices() if 'GPU' in name]
628
629 global _LOCAL_DEVICES
630 if _LOCAL_DEVICES is None:
631 _LOCAL_DEVICES = get_session().list_devices()
632 return [x.name for x in _LOCAL_DEVICES if x.device_type == 'GPU']
633
634
635def _has_nchw_support():

Callers 1

_has_nchw_supportFunction · 0.85

Calls 2

get_sessionFunction · 0.70
list_devicesMethod · 0.45

Tested by

no test coverage detected