Why the output of torch.rand() keeps only four decimal places

Hi all,
I’m currently working on a project related to diffusion models and I have encountered an issue with the torch.rand() function. I have noticed that the output of this function only has four decimal places, even when multiplied by certain numbers. I have checked the documentation for this function but I am still confused about why this is happening.
Can anyone offer any insights into this issue? Thanks!
Some examples:

>>> a = torch.rand(1)
>>> print(a)
>>> a * 0.999
>>> a * 0.001
>>> a * 0.0001
>>> a * 0.9991
>>> a * 0.99991

This is just how the tensors are displayed. If you print(a.item()), you should see more figures. You can force the data type in torch.rand(), too, with the keyword argument dtype = torch.<your desired datatype, eg. float64> which can allow for even more significant figures, if you’d like.

Check out this topic if you want to always print your tensors with more figures after the decimal shown.