(device: str, dispatch_table: dict[str, Callable], *args, **kwargs)
| 1489 | |
| 1490 | # This dispatches a defined function according to the accelerator from the function definitions. |
| 1491 | def _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 |
no outgoing calls
no test coverage detected
searching dependent graphs…