()
return t.device('cuda' if t.cuda.is_available() else 'cpu')
PyTorch default device is GPU when available, CPU otherwise.

    :return: Default device.
PyTorch default device is GPU when available, CPU otherwise.
PyTorch default device is GPU when available CPU otherwise .
def default_device() -> t.device:
    """
    PyTorch default device is GPU when available, CPU otherwise.

    :return: Default device.
    """
    return t.device('cuda' if t.cuda.is_available() else 'cpu')
def default_device ( ) -> t . device : return t . device ( 'cuda' if t . cuda . is_available ( ) else 'cpu' )