MCPcopy Index your code
hub / github.com/huggingface/diffusers / _device_agnostic_dispatch

Function _device_agnostic_dispatch

tests/testing_utils.py:1491–1502  ·  view source on GitHub ↗
(device: str, dispatch_table: dict[str, Callable], *args, **kwargs)

Source from the content-addressed store, hash-verified

1489
1490# This dispatches a defined function according to the accelerator from the function definitions.
1491def _device_agnostic_dispatch(device: str, dispatch_table: dict[str, Callable], *args, **kwargs):
1492 if device not in dispatch_table:
1493 return dispatch_table["default"](*args, **kwargs)
1494
1495 fn = dispatch_table[device]
1496
1497 # Some device agnostic functions return values. Need to guard against 'None' instead at
1498 # user level
1499 if not callable(fn):
1500 return fn
1501
1502 return fn(*args, **kwargs)
1503
1504
1505# These are callables which automatically dispatch the function specific to the accelerator

Callers 7

backend_manual_seedFunction · 0.70
backend_synchronizeFunction · 0.70
backend_empty_cacheFunction · 0.70
backend_device_countFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…