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

Function _get_local_backends

tensorflow/compiler/xla/python/xla_client.py:219–239  ·  view source on GitHub ↗

Instantiates all known local backends.

()

Source from the content-addressed store, hash-verified

217
218
219def _get_local_backends():
220 """Instantiates all known local backends."""
221 global _local_backends
222 if _local_backends is not None:
223 return _local_backends
224
225 _local_backends = collections.OrderedDict()
226 for name, factory in _local_backend_factories.items():
227 logging.vlog(2, "Initializing backend '%s'" % name)
228 try:
229 backend = factory()
230 except RuntimeError:
231 if name == 'cpu':
232 # We always expect CPU to initialize successfully.
233 raise
234 else:
235 # If the backend isn't built into the binary, or if it has no devices,
236 # we expect a RuntimeError.
237 continue
238 _local_backends[name] = backend
239 return _local_backends
240
241
242def get_local_backend(name=None):

Callers 1

get_local_backendFunction · 0.85

Calls 1

factoryFunction · 0.85

Tested by

no test coverage detected