def _get_device(device: str) -> torch.device:
        """Get the device to use for inference.

        Args:
            device (str): Device to use for inference.
                Options are ``"auto"``, ``"cpu"``, ``"cuda"``, ``"gpu"``.

        Returns:
            torch.device: PyTorch device object.

        Raises:
            ValueError: If an invalid device is specified.

        Example:
            >>> model = TorchInferencer(path="path/to/model.pt", device="cpu")
            >>> model.device
            device(type='cpu')
        """
        if device not in {"auto", "cpu", "cuda", "gpu"}:
            msg = f"Unknown device {device}"
            raise ValueError(msg)

        if device == "auto":
            device = "cuda" if torch.cuda.is_available() else "cpu"
        elif device == "gpu":
            device = "cuda"
        return torch.device(device)
Get the device to use for inference.

        Args:
            device (str): Device to use for inference.
                Options are ``"auto"``, ``"cpu"``, ``"cuda"``, ``"gpu"``.

        Returns:
            torch.device: PyTorch device object.

        Raises:
            ValueError: If an invalid device is specified.

        Example:
            >>> model = TorchInferencer(path="path/to/model.pt", device="cpu")
            >>> model.device
            device(type='cpu')
        
src/anomalib/deploy/inferencers/torch_inferencer.py