Skip to content

Exponent not shown when printing small numbers #147

@bamos

Description

@bamos

Hi, this issue may be already known as improve tensor printing in #5, but I'm filing it here just to make sure it doesn't slip through since I was very surprised my tensors appeared to be very large. The print function currently shows the exponent for large numbers, but interestingly doesn't show the exponent for small numbers.

In [11]: x = 1e10*torch.randn(4)

In [12]: x
Out[12]:

 7.9325e+09
 9.7808e+08
-3.4591e+09
 5.9174e+09
[torch.FloatTensor of size 4]

In [7]: x = 1e-10*torch.randn(4)

In [8]: x
Out[8]:

 0.5974
-0.6484
-1.4333
-0.5847
[torch.FloatTensor of size 4]

In [9]: x.numpy()
Out[9]:
array([  5.97383323e-11,  -6.48383500e-11,  -1.43326517e-10,
        -5.84739063e-11], dtype=float32)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions