torch.set_default_dtype¶
-
torch.set_default_dtype(d)[source]¶ Sets the default floating point dtype to
d. This type will be used as default floating point type for type inference intorch.tensor().The default floating point dtype is initially
torch.float32.- Parameters
d (
torch.dtype) – the floating point dtype to make the default
Example:
>>> torch.tensor([1.2, 3]).dtype # initial default for floating point is torch.float32 torch.float32 >>> torch.set_default_dtype(torch.float64) >>> torch.tensor([1.2, 3]).dtype # a new floating point tensor torch.float64