# Why are periods used when creating tensors of integers?

Hey guys, so I’m working through 04_mnist_basics and have noticed twice now that when creating tensors of integers, the subject matter places a period after each integer. Here’s an example:

``````tensor([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10., 11., 12., 13., 14., 15., 16., 17., 18., 19.])
``````

Note: this is the output message of the following line of code:

``````time = torch.arange(0,20).float(); time
``````

I’d like to ask for the purpose of this sort of notation. Is it purely a formatting thing? Do I need to add periods after my integers when creating a tensor?

The period is a decimal point, and indicates that it’s actually a float. You can see that the code that assigns the `time` variable uses `.float()` which makes it a float.

2 Likes

Hi Robert
Computers store two types of numbers integers (1,2,3 etc) and floating point numbers which are an approximation so consider 1/3. As fraction we say one third but computer hardware does not do fractions so it is stored as 0.33333333333333 but of course 3 * 0.33333333333 = 0.99999999999 not 1. So Basically tensors are subject to calculations and we store them as floating point so we tell the computer to use floating point by adding the decimal point.
Regards Conwyn

1 Like