-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Description
π Describe the bug
The abs() function gives incorrect results when using Complex64 tensors on an MPS device. It appears to be some kind of indexing issue per the example below.
import torch
with torch.device("cpu"):
print(torch.ones((2,), dtype=torch.complex64).abs())
with torch.device("mps"):
print(torch.ones((2,), dtype=torch.complex64).abs())
print(torch.tensor([1.0 + 0.0j, 0.0 + 10.0j, 100.0 + 0.0j, 1000.0 + 0.0j]).abs())
Output:
tensor([1., 1.])
tensor([1., 0.], device='mps:0')
tensor([ 1., 0., 10., 0.], device='mps:0')
Versions
Collecting environment information...
PyTorch version: 2.4.0.dev20240428
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: macOS 14.4.1 (arm64)
GCC version: Could not collect
Clang version: 15.0.0 (clang-1500.1.0.2.5)
CMake version: version 3.28.3
Libc version: N/A
Python version: 3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:34:54) [Clang 16.0.6 ] (64-bit runtime)
Python platform: macOS-14.4.1-arm64-arm-64bit
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:
Apple M2 Pro
Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] torch==2.4.0.dev20240428
[pip3] torchaudio==2.2.0.dev20240428
[pip3] torchvision==0.19.0.dev20240428
[conda] numpy 1.26.4 py311h7125741_0 conda-forge
[conda] pytorch 2.4.0.dev20240428 py3.11_0 pytorch-nightly
[conda] torchaudio 2.2.0.dev20240428 py311_cpu pytorch-nightly
[conda] torchvision 0.19.0.dev20240428 py311_cpu pytorch-nightly
cc @ezyang @anjali411 @dylanbespalko @mruberry @lezcano @nikitaved @amjames @kulinseth @albanD @malfet @DenisVieriu97 @jhavukainen