問題文
A team writes torch.tensor([1, 2, 3]) and torch.tensor([1.0, 2.0, 3.0]) in the same script, then is surprised that the two tensors report different dtypes. Which description of the default behavior is correct?
選択肢
- The dtype is inferred from the Python data, so the integer list gives an integer tensor and the float list gives a floating point tensor.
- Both calls produce the same floating point dtype, and every PyTorch tensor is stored internally as a floating point buffer.
- The dtype depends on the current device, not on the data.
- The dtype is always the 64-bit float type unless the tensor is moved to a GPU.