Confusion regarding tensor.dtypes #605
-
Beta Was this translation helpful? Give feedback.
Answered by
mrdbourke
Aug 25, 2023
Replies: 1 comment 1 reply
-
Hi there, This is likely due to setting And see: https://discuss.pytorch.org/t/how-to-print-more-than-4-digits-after-decimal/63405 ExampleDefault print options. import torch
float16 = torch.tensor([0.0102030405], dtype=torch.float16)
float32 = torch.tensor([0.0102030405], dtype=torch.float32)
float64 = torch.tensor([0.0102030405], dtype=torch.float64)
print(float16)
print(float32)
print(float64) Output:
Set print options precision to 10: # Set precision equal to 10
torch.set_printoptions(precision=10)
print(float16)
print(float32)
print(float64) Output:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
AksharGoyal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there,
This is likely due to setting
torch.set_printoptions
, see: https://pytorch.org/docs/stable/generated/torch.set_printoptions.html#torch.set_printoptionsAnd see: https://discuss.pytorch.org/t/how-to-print-more-than-4-digits-after-decimal/63405
Example
Default print options.
Output:
Set print options precision to 10: