"""Device utilities for PyTorch."""

from __future__ import annotations
import torch


def get_device() -> torch.device:
    """Get the best available device (CUDA if available, else CPU).

    Returns:
        torch.device: CUDA device if available, otherwise CPU
    """
    return torch.device("cuda" if torch.cuda.is_available() else "cpu")


def get_device_str() -> str:
    """Get the best available device as a string.

    Returns:
        str: "cuda" if available, otherwise "cpu"
    """
    return "cuda" if torch.cuda.is_available() else "cpu"
