Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18292
ghimport-source-id:
a3e96584db0eef7b6202a1211808f9f6e59dd529
Stack from [ghstack](https://github.com/ezyang/ghstack):
* **#18292 Add test for #17271 (torch.exp incorrect for 2**31 size tensor)**
* #18291 Correctly call superclass setUp in TestCase subclasses.
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Differential Revision:
D14567642
fbshipit-source-id:
c60ee7597a86f5d2c5c0b72cb106f17815950427
return inf
self._test_math(torch.exp, exp)
+ @slowTest
+ def test_exp_slow(self):
+ # Test for https://github.com/pytorch/pytorch/issues/17271
+ # This is pretty slow on my Macbook but it only takes a few
+ # seconds on a beefy Xeon server
+ a = torch.exp(torch.ones(2 ** 31, dtype=torch.float32))
+ b = torch.exp(torch.ones(1, dtype=torch.float32))
+ self.assertEqual(a, b.expand(2 ** 31))
+
def test_expm1(self):
def expm1(x):
try: