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

Function device

tensorflow/python/framework/test_util.py:1452–1459  ·  view source on GitHub ↗

Uses gpu when requested and available.

(use_gpu)

Source from the content-addressed store, hash-verified

1450
1451@contextlib.contextmanager
1452def device(use_gpu):
1453 """Uses gpu when requested and available."""
1454 if use_gpu and is_gpu_available():
1455 dev = "/device:GPU:0"
1456 else:
1457 dev = "/device:CPU:0"
1458 with ops.device(dev):
1459 yield
1460
1461
1462@contextlib.contextmanager

Callers 1

use_gpuFunction · 0.70

Calls 2

is_gpu_availableFunction · 0.85
deviceMethod · 0.45

Tested by

no test coverage detected