Repository: pytorch
Issue: Python 3.12 CPU TestBinaryUfuncsCPU.test_cumulative_trapezoid_cpu is failing
Labels: module: tests,triaged,module: scipy compatibility

### 🐛 Describe the bug

I observe following failure when adding support for python 3.12 CPU, workflow : linux-focal-py3.12-clang10

Failure can be seen here:
https://github.com/pytorch/pytorch/actions/runs/7831757776/job/21369587621?pr=117853

Log:
```
2024-02-08T15:46:42.1565742Z ______________ TestBinaryUfuncsCPU.test_cumulative_trapezoid_cpu _______________
2024-02-08T15:46:42.1565874Z Traceback (most recent call last):
2024-02-08T15:46:42.1566360Z   File "/var/lib/jenkins/workspace/test/test_binary_ufuncs.py", line 3933, in test_cumulative_trapezoid
2024-02-08T15:46:42.1566494Z     test_dx((0, 2), 0, 1.0, device)
2024-02-08T15:46:42.1566870Z   File "/var/lib/jenkins/workspace/test/test_binary_ufuncs.py", line 3905, in test_dx
2024-02-08T15:46:42.1567173Z     expected = scipy_cumulative_trapezoid(t.cpu().numpy(), dx=dx, axis=dim)
2024-02-08T15:46:42.1567335Z                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-08T15:46:42.1568059Z   File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/scipy/integrate/_quadrature.py", line 494, in cumulative_trapezoid
2024-02-08T15:46:42.1568340Z     raise ValueError("At least one point is required along `axis`.")
2024-02-08T15:46:42.1568558Z ValueError: At least one point is required along `axis`.
2024-02-08T15:46:42.1568566Z 
2024-02-08T15:46:42.1568817Z To execute this test, run the following from the base repo dir:
2024-02-08T15:46:42.1569166Z      python test/test_binary_ufuncs.py -k test_cumulative_trapezoid_cpu
2024-02-08T15:46:42.1569172Z 
2024-02-08T15:46:42.1569593Z This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
2024-02-08T15:46:42.1569917Z ______________ TestBinaryUfuncsCPU.test_cumulative_trapezoid_cpu _______________
2024-02-08T15:46:42.1570047Z Traceback (most recent call last):
2024-02-08T15:46:42.1570531Z   File "/var/lib/jenkins/workspace/test/test_binary_ufuncs.py", line 3933, in test_cumulative_trapezoid
2024-02-08T15:46:42.1570662Z     test_dx((0, 2), 0, 1.0, device)
2024-02-08T15:46:42.1571037Z   File "/var/lib/jenkins/workspace/test/test_binary_ufuncs.py", line 3905, in test_dx
2024-02-08T15:46:42.1571324Z     expected = scipy_cumulative_trapezoid(t.cpu().numpy(), dx=dx, axis=dim)
2024-02-08T15:46:42.1571505Z                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-08T15:46:42.1572266Z   File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/scipy/integrate/_quadrature.py", line 494, in cumulative_trapezoid
2024-02-08T15:46:42.1572548Z     raise ValueError("At least one point is required along `axis`.")
2024-02-08T15:46:42.1572765Z ValueError: At least one point is required along `axis`.
2024-02-08T15:46:42.1572772Z 
2024-02-08T15:46:42.1573024Z To execute this test, run the following from the base repo dir:
2024-02-08T15:46:42.1573372Z      python test/test_binary_ufuncs.py -k test_cumulative_trapezoid_cpu
2024-02-08T15:46:42.1573378Z 
2024-02-08T15:46:42.1573694Z This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
2024-02-08T15:46:42.1573917Z =================================== FAILURES ===================================
2024-02-08T15:46:42.1574237Z ______________ TestBinaryUfuncsCPU.test_cumulative_trapezoid_cpu _______________
2024-02-08T15:46:42.1574400Z Traceback (most recent call last):
2024-02-08T15:46:42.1574899Z   File "/var/lib/jenkins/workspace/test/test_binary_ufuncs.py", line 3933, in test_cumulative_trapezoid
2024-02-08T15:46:42.1575017Z     test_dx((0, 2), 0, 1.0, device)
2024-02-08T15:46:42.1575387Z   File "/var/lib/jenkins/workspace/test/test_binary_ufuncs.py", line 3905, in test_dx
2024-02-08T15:46:42.1575687Z     expected = scipy_cumulative_trapezoid(t.cpu().numpy(), dx=dx, axis=dim)
2024-02-08T15:46:42.1575843Z                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-08T15:46:42.1576559Z   File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/scipy/integrate/_quadrature.py", line 494, in cumulative_trapezoid
2024-02-08T15:46:42.1576840Z     raise ValueError("At least one point is required along `axis`.")
2024-02-08T15:46:42.1577055Z ValueError: At least one point is required along `axis`.
2024-02-08T15:46:42.1577061Z 
2024-02-08T15:46:42.1577322Z To execute this test, run the following from the base repo dir:
2024-02-08T15:46:42.1577658Z      python test/test_binary_ufuncs.py -k test_cumulative_trapezoid_cpu
2024-02-08T15:46:42.1577666Z 
2024-02-08T15:46:42.1577980Z This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
2024-02-08T15:46:42.1578812Z - generated xml file: /var/lib/jenkins/workspace/test/test-reports/python-pytest/test_binary_ufuncs/test_binary_ufuncs-eab6227513a46616.xml -
2024-02-08T15:46:42.1579021Z =========================== short test summary info ============================
2024-02-08T15:46:42.1579813Z FAILED [0.0025s] test_binary_ufuncs.py::TestBinaryUfuncsCPU::test_cumulative_trapezoid_cpu - ValueError: At least one point is required along `axis`.
2024-02-08T15:46:42.1579833Z 
2024-02-08T15:46:42.1580085Z To execute this test, run the following from the base repo dir:
2024-02-08T15:46:42.1580420Z      python test/test_binary_ufuncs.py -k test_cumulative_trapezoid_cpu
2024-02-08T15:46:42.1580426Z 
2024-02-08T15:46:42.1580755Z This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
2024-02-08T15:46:42.1580976Z !!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
2024-02-08T15:46:42.1581220Z ================= 1 failed, 6220 deselected, 2 rerun in 1.18s ==================
2024-02-08T15:46:42.1581335Z Got exit code 1
2024-02-08T15:46:42.1581466Z Retrying...
2024-02-08T15:46:42.1582102Z Test results will be stored in test-reports/python-pytest/test_binary_ufuncs/test_binary_ufuncs-e5d393dd2b36f0d2.xml
2024-02-08T15:46:42.1582314Z ============================= test session starts ==============================
2024-02-08T15:46:42.1582811Z platform linux -- Python 3.12.1, pytest-7.3.2, pluggy-1.4.0 -- /opt/conda/envs/py_3.12/bin/python
2024-02-08T15:46:42.1582937Z cachedir: .pytest_cache
2024-02-08T15:46:42.1583617Z hypothesis profile 'pytorch_ci' -> database=None, max_examples=50, derandomize=True, suppress_health_check=[HealthCheck.too_slow]
2024-02-08T15:46:42.1583748Z rootdir: /var/lib/jenkins/workspace
2024-02-08T15:46:42.1583875Z configfile: pytest.ini
2024-02-08T15:46:42.1584459Z plugins: hypothesis-5.35.1, cpp-2.3.0, flakefinder-1.1.0, rerunfailures-13.0, xdist-3.3.1, xdoctest-1.1.0
2024-02-08T15:46:42.1584734Z collecting ... collected 12851 items / 6220 deselected / 6631 selected
2024-02-08T15:46:42.1584913Z stepcurrent: skipping 6220 already run items.
2024-02-08T15:46:42.1585042Z Running 6631 items in this shard
2024-02-08T15:46:42.1585048Z 
2024-02-08T15:46:42.1585658Z test_binary_ufuncs.py::TestBinaryUfuncsCPU::test_cumulative_trapezoid_cpu ('RERUN', {'yellow': True}) [0.4818s] [  0%]
2024-02-08T15:46:42.1586277Z test_binary_ufuncs.py::TestBinaryUfuncsCPU::test_cumulative_trapezoid_cpu ('RERUN', {'yellow': True}) [0.0035s] [  0%]
2024-02-08T15:46:42.1586722Z test_binary_ufuncs.py::TestBinaryUfuncsCPU::test_cumulative_trapezoid_cpu FAILED [0.0032s] [  0%]
2024-02-08T15:46:42.1586728Z 
2024-02-08T15:46:42.1586924Z ==================================== RERUNS ====================================
2024-02-08T15:46:42.1587271Z ______________ TestBinaryUfuncsCPU.test_cumulative_trapezoid_cpu _______________
2024-02-08T15:46:42.1587405Z Traceback (most recent call last):
2024-02-08T15:46:42.1587900Z   File "/var/lib/jenkins/workspace/test/test_binary_ufuncs.py", line 3933, in test_cumulative_trapezoid
2024-02-08T15:46:42.1588016Z     test_dx((0, 2), 0, 1.0, device)
2024-02-08T15:46:42.1588402Z   File "/var/lib/jenkins/workspace/test/test_binary_ufuncs.py", line 3905, in test_dx
2024-02-08T15:46:42.1588689Z     expected = scipy_cumulative_trapezoid(t.cpu().numpy(), dx=dx, axis=dim)
2024-02-08T15:46:42.1588848Z                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-08T15:46:42.1589580Z   File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/scipy/integrate/_quadrature.py", line 494, in cumulative_trapezoid
2024-02-08T15:46:42.1589846Z     raise ValueError("At least one point is required along `axis`.")
2024-02-08T15:46:42.1590061Z ValueError: At least one point is required along `axis`.
2024-02-08T15:46:42.1590067Z 
2024-02-08T15:46:42.1590334Z To execute this test, run the following from the base repo dir:
2024-02-08T15:46:42.1590670Z      python test/test_binary_ufuncs.py -k test_cumulative_trapezoid_cpu
2024-02-08T15:46:42.1590675Z 
2024-02-08T15:46:42.1591002Z This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
2024-02-08T15:46:42.1591309Z ______________ TestBinaryUfuncsCPU.test_cumulative_trapezoid_cpu _______________
2024-02-08T15:46:42.1591438Z Traceback (most recent call last):
2024-02-08T15:46:42.1591931Z   File "/var/lib/jenkins/workspace/test/test_binary_ufuncs.py", line 3933, in test_cumulative_trapezoid
2024-02-08T15:46:42.1592049Z     test_dx((0, 2), 0, 1.0, device)
2024-02-08T15:46:42.1592420Z   File "/var/lib/jenkins/workspace/test/test_binary_ufuncs.py", line 3905, in test_dx
2024-02-08T15:46:42.1592793Z     expected = scipy_cumulative_trapezoid(t.cpu().numpy(), dx=dx, axis=dim)
2024-02-08T15:46:42.1593021Z                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-08T15:46:42.1594244Z   File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/scipy/integrate/_quadrature.py", line 494, in cumulative_trapezoid
2024-02-08T15:46:42.1594528Z     raise ValueError("At least one point is required along `axis`.")
2024-02-08T15:46:42.1596290Z ValueError: At least one point is required along `axis`.
2024-02-08T15:46:42.1596400Z 
2024-02-08T15:46:42.1596684Z To execute this test, run the following from the base repo dir:
2024-02-08T15:46:42.1597043Z      python test/test_binary_ufuncs.py -k test_cumulative_trapezoid_cpu
2024-02-08T15:46:42.1597049Z 
2024-02-08T15:46:42.1597362Z This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
2024-02-08T15:46:42.1597561Z =================================== FAILURES ===================================
2024-02-08T15:46:42.1597875Z ______________ TestBinaryUfuncsCPU.test_cumulative_trapezoid_cpu _______________
2024-02-08T15:46:42.1598018Z Traceback (most recent call last):
2024-02-08T15:46:42.1598505Z   File "/var/lib/jenkins/workspace/test/test_binary_ufuncs.py", line 3933, in test_cumulative_trapezoid
2024-02-08T15:46:42.1598658Z     test_dx((0, 2), 0, 1.0, device)
2024-02-08T15:46:42.1599133Z   File "/var/lib/jenkins/workspace/test/test_binary_ufuncs.py", line 3905, in test_dx
2024-02-08T15:46:42.1599422Z     expected = scipy_cumulative_trapezoid(t.cpu().numpy(), dx=dx, axis=dim)
2024-02-08T15:46:42.1599583Z                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-08T15:46:42.1600323Z   File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/scipy/integrate/_quadrature.py", line 494, in cumulative_trapezoid
2024-02-08T15:46:42.1600586Z     raise ValueError("At least one point is required along `axis`.")
2024-02-08T15:46:42.1600840Z ValueError: At least one point is required along `axis`.
2024-02-08T15:46:42.1600860Z 
2024-02-08T15:46:42.1601110Z To execute this test, run the following from the base repo dir:
2024-02-08T15:46:42.1601482Z      python test/test_binary_ufuncs.py -k test_cumulative_trapezoid_cpu
2024-02-08T15:46:42.1601491Z 
2024-02-08T15:46:42.1601822Z This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
2024-02-08T15:46:42.1602648Z - generated xml file: /var/lib/jenkins/workspace/test/test-reports/python-pytest/test_binary_ufuncs/test_binary_ufuncs-e5d393dd2b36f0d2.xml -
2024-02-08T15:46:42.1602858Z =========================== short test summary info ============================
2024-02-08T15:46:42.1603670Z FAILED [0.0032s] test_binary_ufuncs.py::TestBinaryUfuncsCPU::test_cumulative_trapezoid_cpu - ValueError: At least one point is required along `axis`.
2024-02-08T15:46:42.1603677Z 
2024-02-08T15:46:42.1603929Z To execute this test, run the following from the base repo dir:
2024-02-08T15:46:42.1604279Z      python test/test_binary_ufuncs.py -k test_cumulative_trapezoid_cpu
2024-02-08T15:46:42.1604285Z 
2024-02-08T15:46:42.1604598Z This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
2024-02-08T15:46:42.1604817Z !!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
2024-02-08T15:46:42.1605081Z ================= 1 failed, 6220 deselected, 2 rerun in 1.63s ==================
```

cc @mruberry @ZainRizvi @alban

### Versions

2.3.0 nightly