| commit | 51c2075f1666fabd3921b6d715f4794c3b9e9667 | [log] [tgz] |
|---|---|---|
| author | Sam Gross <sgross@fb.com> | Tue Oct 17 13:08:07 2017 -0700 |
| committer | Zachary DeVito <zdevito@gmail.com> | Wed Oct 18 13:53:09 2017 -0700 |
| tree | 1aa7e06288aba711ad57f6ece6aaa917b6b0f134 | |
| parent | 88b5bf8ec08f19c817019fa229eef0b1c6c92431 [diff] |
Relax Scalar::toXXX conversions to only check for overflow
Currently, the toXXX functions on Scalar check that the conversions are
exact. This will cause an exception in code like:
auto t = CPU(kFloat).ones({1});
t *= M_PI;
Or the equivalent in Python:
t = torch.ones(1)
t *= math.pi
This changes the checks to only throw an exception in the case of
overflow (positive or negative).