Repository: pytorch
Issue: Scipy 1.7.0 may cause some test failures
Labels: module: distributions,module: tests,triaged

## 🐛 Bug

Scipy 1.7.0 may cause some test failures. Downgrade to `scipy==1.6.0` resolves the issue.

## To Reproduce

Steps to reproduce the behavior:

```
python test/distributions/test_distributions.py -v -k test_poisson_gpu_sample
```

```
test_poisson_gpu_sample (__main__.TestDistributions) ... ERROR

======================================================================
ERROR: test_poisson_gpu_sample (__main__.TestDistributions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/torch/testing/_internal/common_utils.py", line 1033, in wrapper
    method(*args, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/torch/testing/_internal/common_utils.py", line 1033, in wrapper
    method(*args, **kwargs)
  File "test/distributions/test_distributions.py", line 1340, in test_poisson_gpu_sample
    self._check_sampler_discrete(Poisson(torch.tensor([rate]).cuda()),
  File "test/distributions/test_distributions.py", line 805, in _check_sampler_discrete
    chisq, p = scipy.stats.chisquare(counts[msk], pmf[msk] * num_samples)
  File "/opt/conda/lib/python3.8/site-packages/scipy/stats/stats.py", line 6852, in chisquare
    return power_divergence(f_obs, f_exp=f_exp, ddof=ddof, axis=axis,
  File "/opt/conda/lib/python3.8/site-packages/scipy/stats/stats.py", line 6694, in power_divergence
    raise ValueError(msg)
ValueError: For each axis slice, the sum of the observed frequencies must agree with the sum of the expected frequencies to a relative tolerance of 1e-08, but the percent differences are:
3.6727285765597826e-05

----------------------------------------------------------------------
Ran 1 test in 13.693s

FAILED (errors=1)
```

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

## Environment

ecc3718

```
Collecting environment information...
PyTorch version: 1.9.0a0+ecc3718
Is debug build: False
CUDA used to build PyTorch: ---
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.2 LTS (x86_64)
GCC version: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Clang version: Could not collect
CMake version: version 3.20.5

Python version: 3.8 (64-bit runtime)
Is CUDA available: True
CUDA runtime version: ---
GPU models and configuration:
GPU 0: A100-SXM4-40GB
GPU 1: A100-SXM4-40GB
GPU 2: A100-SXM4-40GB
GPU 3: A100-SXM4-40GB
GPU 4: A100-SXM4-40GB
GPU 5: A100-SXM4-40GB
GPU 6: A100-SXM4-40GB
GPU 7: A100-SXM4-40GB

Nvidia driver version: 450.51.06
cuDNN version: Probably one of the following:
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.21.0
[pip3] torch==1.9.0a0+ecc3718
[pip3] torchtext==0.10.0a0
[pip3] torchvision==0.10.0a0
[conda] mkl                       2019.5                      281    conda-forge
[conda] mkl-include               2019.5                      281    conda-forge
[conda] numpy                     1.21.0           py38h9894fe3_0    conda-forge
[conda] torch                     1.9.0a0+ecc3718          pypi_0    pypi
[conda] torchtext                 0.10.0a0                 pypi_0    pypi
[conda] torchvision               0.10.0a0                 pypi_0    pypi
```

## Additional context

n/a

cc @fritzo @neerajprad @alicanb @nikitaved @mruberry @VitalyFedyunin @walterddr @ptrblck