From: Nikita Shulga Date: Mon, 13 Sep 2021 19:46:11 +0000 (-0700) Subject: Pin SciPy to 1.6.3 on Mac (take 2) (#64922) X-Git-Tag: accepted/tizen/8.0/unified/20231005.095509~257 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af984c78a975400ffd8c475a7e00abb25e590bb1;p=platform%2Fupstream%2Fpytorch.git Pin SciPy to 1.6.3 on Mac (take 2) (#64922) Summary: It's already pinned by via docker install on Linux `scipy.stats.`[`poission`|`geom`|`binom`] returns quite different results between 1.6.x and 1.7+ versions of SciPy, which results in several distributions tests failing accuracy thresholds Reland of https://github.com/pytorch/pytorch/pull/64844 but limited to just Mac platform Followup PR for Windows are coming as well Pull Request resolved: https://github.com/pytorch/pytorch/pull/64922 Reviewed By: janeyx99 Differential Revision: D30901257 Pulled By: malfet fbshipit-source-id: 0543e7bae9d3bbeb8b6be7b3ecf605880f97665f --- diff --git a/.jenkins/pytorch/macos-test.sh b/.jenkins/pytorch/macos-test.sh index 71d6773..d7e223f 100755 --- a/.jenkins/pytorch/macos-test.sh +++ b/.jenkins/pytorch/macos-test.sh @@ -7,7 +7,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/macos-common.sh" export PYTORCH_TEST_SKIP_NOARCH=1 conda install -y six -pip install -q hypothesis "expecttest==0.1.3" "librosa>=0.6.2" "numba<=0.49.1" psutil +pip install -q hypothesis "expecttest==0.1.3" "librosa>=0.6.2" "numba<=0.49.1" psutil "scipy==1.6.3" # TODO move this to docker pip install unittest-xml-reporting pytest diff --git a/test/distributions/test_distributions.py b/test/distributions/test_distributions.py index 268deb5..ee5abb4 100644 --- a/test/distributions/test_distributions.py +++ b/test/distributions/test_distributions.py @@ -20,6 +20,10 @@ change. This file contains two types of randomized tests: it's fine to increment the seed of the failing test (but you shouldn't need to increment it more than once; otherwise something is probably actually wrong). + +3. `test_geometric_sample`, `test_binomial_sample` and `test_poisson_sample` + are validated against `scipy.stats.` which are not guaranteed to be identical + across different versions of scipy (namely, they yield invalid results in 1.7+) """ import math @@ -38,7 +42,7 @@ torch.set_default_dtype(torch.double) from torch._six import inf from torch.testing._internal.common_utils import \ (TestCase, run_tests, set_rng_seed, TEST_WITH_UBSAN, load_tests, - gradcheck, IS_MACOS, IS_WINDOWS) + gradcheck, IS_WINDOWS) from torch.testing._internal.common_cuda import TEST_CUDA from torch.autograd import grad from torch.autograd.functional import jacobian @@ -1035,7 +1039,6 @@ class TestDistributions(TestCase): self.assertEqual(float(Geometric(s).entropy()), scipy.stats.geom(s, loc=-1).entropy().item(), atol=1e-3, rtol=0) @unittest.skipIf(IS_WINDOWS, "See https://github.com/pytorch/pytorch/issues/64595") - @unittest.skipIf(IS_MACOS, "See https://github.com/pytorch/pytorch/issues/60347") @unittest.skipIf(not TEST_NUMPY, "NumPy not found") def test_geometric_sample(self): set_rng_seed(0) # see Note [Randomized statistical tests] @@ -1053,7 +1056,6 @@ class TestDistributions(TestCase): self.assertRaises(NotImplementedError, Binomial(10, p).entropy) @unittest.skipIf(IS_WINDOWS, "See https://github.com/pytorch/pytorch/issues/64595") - @unittest.skipIf(IS_MACOS, "See https://github.com/pytorch/pytorch/issues/60347") @unittest.skipIf(not TEST_NUMPY, "NumPy not found") def test_binomial_sample(self): set_rng_seed(0) # see Note [Randomized statistical tests] @@ -1347,7 +1349,6 @@ class TestDistributions(TestCase): torch.testing.assert_allclose(rate_zero.grad, torch.inf) @unittest.skipIf(IS_WINDOWS, "See https://github.com/pytorch/pytorch/issues/64595") - @unittest.skipIf(IS_MACOS, "See https://github.com/pytorch/pytorch/issues/60347") @unittest.skipIf(not TEST_NUMPY, "Numpy not found") def test_poisson_sample(self): set_rng_seed(1) # see Note [Randomized statistical tests]