From 438ee6ffd06a38ee650261443fadca731a5fe4e6 Mon Sep 17 00:00:00 2001 From: Jeff Yang Date: Wed, 23 Dec 2020 14:23:36 +0630 Subject: [PATCH 1/2] add docstring in torch.cuda.get_device_properties --- torch/cuda/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/torch/cuda/__init__.py b/torch/cuda/__init__.py index a4068ac6d7f3..b8b4195d37b9 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. + + Arguments: + 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(): From 0887d401f08077b4c075e0ae4645453902637455 Mon Sep 17 00:00:00 2001 From: Jeff Yang Date: Wed, 30 Dec 2020 08:48:05 +0630 Subject: [PATCH 2/2] Update torch/cuda/__init__.py --- torch/cuda/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torch/cuda/__init__.py b/torch/cuda/__init__.py index b8b4195d37b9..e87e5515a8ba 100644 --- a/torch/cuda/__init__.py +++ b/torch/cuda/__init__.py @@ -298,7 +298,7 @@ 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. - Arguments: + Args: device (torch.device or int or str): device for which to return the properties of the device.