From fbdafb006e144c313d824688581cbdfc2812e61e Mon Sep 17 00:00:00 2001 From: Derek Kim Date: Thu, 17 Jan 2019 10:07:46 -0800 Subject: [PATCH] Fix trivial typos in torch.cuda._utils (#16026) Summary: Trivial typo fixings. Maybe the indefinite article "an" is needed before each "specified index" but I'm not perfectly sure. Pull Request resolved: https://github.com/pytorch/pytorch/pull/16026 Differential Revision: D13709499 Pulled By: ezyang fbshipit-source-id: 698b000bb8aa063afd81db6e67046456a439b2ce --- aten/src/TH/THTensorApply.h | 2 +- torch/cuda/_utils.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/aten/src/TH/THTensorApply.h b/aten/src/TH/THTensorApply.h index 29e81b0..a806a11 100644 --- a/aten/src/TH/THTensorApply.h +++ b/aten/src/TH/THTensorApply.h @@ -264,7 +264,7 @@ * 1. convert the line index(the index of the element) to the indexs(coordinates) in the tensor. * It can hinted by a classical problem: Getting each individual digit from a whole integer(Decimal base). * A N-digit decimal base number could be view as a N-dimension tensor and the sizes of the tensor are 10. - * So the value the whole interger is the line index. And the digits could be viewed as the indexes in + * So the value the whole integer is the line index. And the digits could be viewed as the indexes in * different dimentions. * * 2. convert the indexs(coordinates) in the tensor to the memory offset. diff --git a/torch/cuda/_utils.py b/torch/cuda/_utils.py index 278664c..0a94a07 100644 --- a/torch/cuda/_utils.py +++ b/torch/cuda/_utils.py @@ -7,11 +7,11 @@ def _get_device_index(device, optional=False): object, a Python integer, or ``None``. If :attr:`device` is a torch.device object, returns the device index if it - is a CUDA device. Note that for CUDA device without sepecified index, i.e., - ``torch.devie('cuda')``, this will return the current default CUDA device if - :attr:`optional` is ``True``. + is a CUDA device. Note that for a CUDA device without a specified index, + i.e., ``torch.device('cuda')``, this will return the current default CUDA + device if :attr:`optional` is ``True``. - If :attr:`device` is a Python interger, it is returned as is. + If :attr:`device` is a Python integer, it is returned as is. If :attr:`device` is ``None``, this will return the current default CUDA device if :attr:`optional` is ``True``. @@ -30,6 +30,6 @@ def _get_device_index(device, optional=False): # default cuda device index return torch.cuda.current_device() else: - raise ValueError('Expected a cuda device with sepecified index or ' - 'an integer, but got: '.format(device)) + raise ValueError('Expected a cuda device with a specified index ' + 'or an integer, but got: '.format(device)) return device_idx -- 2.7.4