8000 test_gradient_all Device Type test regression with Numpy >= 2.0.0 · Issue #132450 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

test_gradient_all Device Type test regression with Numpy >= 2.0.0 #132450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
123epsilon opened this issue Aug 1, 2024 · 4 comments
Open

test_gradient_all Device Type test regression with Numpy >= 2.0.0 #132450

123epsilon opened this issue Aug 1, 2024 · 4 comments
Labels
actionable module: autograd Related to torch.autograd, and the autograd engine in general module: ci Related to continuous integration module: numpy Related to numpy support, and also numpy compatibility of our operators module: tests Issues related to tests (not the torch.testing module) triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@123epsilon
Copy link
123epsilon commented Aug 1, 2024

🐛 Describe the bug

When running the device type test test_gradient_all using numpy==2.0.0 or numpy==2.0.1 I get the following failure for all dtypes:

AssertionError: The length of the sequences mismatch: 2 != 1

This is due to the np.gradient function producing fewer tensors in its output than expected in v2.0.0 - I have been able to confirm that installing numpy==1.26.4 and then running the test causes the test to pass.

To reproduce:

# ... setup pytorch ( I set it up from source)
pip install numpy==2.0.1
python test/test_torch.py -k TestTorchDeviceTypeCPU.test_gradient_all --verbose
...
# we get the failure
AssertionError: The length of the sequences mismatch: 2 != 1

pip install numpy==1.26.4
python test/test_torch.py -k TestTorchDeviceTypeCPU.test_gradient_all --verbose
...
# tests pass
OK

Honestly I haven't looked too deeply into the test logic, but I do know that it is the call to np.gradient that is causing the failure. I don't know what an appropriate solution, if any, is since this doesn't technically affect the correctness of torch.gradient - perhaps raise an issue in numpy?

Versions

PyTorch version: 2.4.0a0+gitc84e248
Is debug build: False
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: 6.0.32831-204d35d16

OS: Ubuntu 22.04.4 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.30.1
Libc version: glibc-2.35

Python version: 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0] (64-bit runtime)
Python platform: Linux-6.2.0-39-generic-x86_64-with-glibc2.35
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 48 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 128
On-line CPU(s) list: 0-127
Vendor ID: AuthenticAMD
Model name: AMD EPYC 7713 64-Core Processor
CPU family: 25
Model: 1
Thread(s) per core: 1
Core(s) per socket: 64
Socket(s): 2
Stepping: 1
Frequency boost: enabled
CPU max MHz: 3720.7029
CPU min MHz: 1500.0000
BogoMIPS: 3992.24
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 invpcid_single hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin brs arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm
Virtualization: AMD-V
L1d cache: 4 MiB (128 instances)
L1i cache: 4 MiB (128 instances)
L2 cache: 64 MiB (128 instances)
L3 cache: 512 MiB (16 instances)
NUMA node(s): 2
NUMA node0 CPU(s): 0-63
NUMA node1 CPU(s): 64-127
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Mitigation; safe RET
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP disabled, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected

Versions of relevant libraries:
[pip3] numpy==2.0.0
[pip3] optree==0.12.1
[pip3] torch==2.4.0a0+gitc84e248
[conda] numpy 2.0.0 pypi_0 pypi
[conda] optree 0.12.1 pypi_0 pypi
[conda] torch 2.4.0a0+gitc84e248 pypi_0 pypi

cc @ezyang @albanD @gqchen @pearu @nikitaved @soulitzer @Varal7 @xmfan @seemethere @malfet @pytorch/pytorch-dev-infra @mruberry @ZainRizvi @rgommers

@malfet malfet added module: autograd Related to torch.autograd, and the autograd engine in general module: ci Related to continuous integration labels Aug 2, 2024
@malfet malfet added module: tests Issues related to tests (not the torch.testing module) triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Aug 2, 2024
@soulitzer soulitzer added the module: numpy Related to numpy support, and also numpy compatibility of our operators label Aug 2, 2024
@albanD
Copy link
Collaborator
albanD commented Aug 5, 2024

I think this is fixed as part of #130689 that will be merged piece by piece

@123epsilon
Copy link
Author

Ah I see, great

@albanD
Copy link
Collaborator
albanD commented Aug 5, 2024

Keeping this open until we land the fix!

@soulitzer
Copy link
Contributor

@kiukchung FYI, do you know if this one is still failing or has it been fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actionable module: autograd Related to torch.autograd, and the autograd engine in general module: ci Related to continuous integration module: numpy Related to numpy support, and also numpy compatibility of our operators module: tests Issues related to tests (not the torch.testing module) triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
Archived in project
Development

No branches or pull requests

4 participants
0