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)
tensor([0.6181])
>>> a * 0.999
tensor([0.6175])
>>> a * 0.001
tensor([0.0006])
>>> a * 0.0001
tensor([6.1810e-05])
>>> a * 0.9991
tensor([0.6175])
>>> a * 0.99991
tensor([0.6180])

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.