Revision 536cda7c9a146b9198f83837ba439a5afbdc074d authored by Kenichi Maehashi on 29 June 2022, 08:16:52 UTC, committed by GitHub on 29 June 2022, 08:16:52 UTC
2 parent s e9da142 + 8b997ad
Raw File
_device.py
import chainerx


def _recover_device(backend_name, device_index):
    # Recovers the device instance.
    # This function is used together with chainerx.Device.__reduce__.
    # TODO(niboshi): Save the context name and lookup the context with it.
    context = chainerx.get_default_context()
    backend = context.get_backend(backend_name)
    device = backend.get_device(device_index)
    return device
back to top