Values randn in pytorch

x = torch.randn(1)
print(x)
print(x.item())

The output of the above code is

tensor([0.3369])
0.3368943929672241  # this is python number

When doing operations on x , what values will be used for the values iniside x? the rounted value( 0.3369) will be used or the number (0.3368943929672241 ) is used?

The complete float32 number will be used. The print(x) uses the default print options, which truncate the output.
You can increase the print precision via: torch.set_printoptions(precision=10) (or to any other value).

1 Like