* 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.
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``.
# 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