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

Function _get_current_tf_device

tensorflow/python/keras/backend.py:585–596  ·  view source on GitHub ↗

Return explicit device of current context, otherwise returns `None`. Returns: If the current device scope is explicitly set, it returns a string with the device (`CPU` or `GPU`). If the scope is not explicitly set, it will return `None`.

()

Source from the content-addressed store, hash-verified

583
584
585def _get_current_tf_device():
586 """Return explicit device of current context, otherwise returns `None`.
587
588 Returns:
589 If the current device scope is explicitly set, it returns a string with
590 the device (`CPU` or `GPU`). If the scope is not explicitly set, it will
591 return `None`.
592 """
593 graph = get_graph()
594 op = _TfDeviceCaptureOp()
595 graph._apply_device_functions(op)
596 return tfdev.DeviceSpec.from_string(op.device)
597
598
599def _is_current_explicit_device(device_type):

Callers 1

Calls 4

get_graphFunction · 0.85
_TfDeviceCaptureOpClass · 0.85
from_stringMethod · 0.80

Tested by

no test coverage detected