diff --git a/torch/cuda/__init__.py b/torch/cuda/__init__.py index a4068ac6d7f3..e87e5515a8ba 100644 --- a/torch/cuda/__init__.py +++ b/torch/cuda/__init__.py @@ -271,6 +271,9 @@ def get_device_name(device: Optional[_device_t] = None) -> str: name. This function is a no-op if this argument is a negative integer. It uses the current device, given by :func:`~torch.cuda.current_device`, if :attr:`device` is ``None`` (default). + + Returns: + str: the name of the device """ return get_device_properties(device).name @@ -293,6 +296,15 @@ def get_device_capability(device: Optional[_device_t] = None) -> Tuple[int, int] def get_device_properties(device: _device_t) -> _CudaDeviceProperties: + r"""Gets the properties of a device. + + Args: + device (torch.device or int or str): device for which to return the + properties of the device. + + Returns: + _CudaDeviceProperties: the properties of the device + """ _lazy_init() # will define _get_device_properties device = _get_device_index(device, optional=True) if device < 0 or device >= device_count():