Combining `bfloat16` with complex scalars raises `NotImplementedError`
- Dominant language
- Python
- Stars
- 103k
- Forks
- 29.6k
- PR merge metrics
- PR metrics pending
Description
### 🐛 Describe the bug
Introduced in #173783
```python
import torch
a = torch.zeros((1,), dtype=torch.bfloat16)
b = complex(0, 0) # Any complex scalar or array with ndim=0
a + b # Any op
```
Gives:
```python
:1: UserWarning: BComplex32 support is experimental and many operators don't support it yet. (Triggered internally at /Users/habbasi/Quansight/torch-build/git/pytorch/aten/src/ATen/EmptyTensor.cpp:58.)
Traceback (most recent call last):
File "", line 1, in
a + b
~~^~~
NotImplementedError: "add_stub" not implemented for 'BComplex32'
```
Previously used to upcast to `complex64`. Affects release versions 2.14.
### Versions
Collecting environment information...
PyTorch version: 2.12.0a0+gitecbeb70
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: macOS 26.3.1 (arm64)
GCC version: Could not collect
Clang version: 19.1.7
CMake version: version 4.2.3
Libc version: N/A
Python version: 3.13.12 | packaged by conda-forge | (main, Feb 5 2026, 06:11:05) [Clang 19.1.7 ] (64-bit runtime)
Python platform: macOS-26.3.1-arm64-arm-64bit-Mach-O
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
Is XPU available: False
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: False
Caching allocator config: N/A
CPU:
Apple M3 Max
Versions of relevant libraries:
[pip3] flake8==7.3.0
[pip3] numpy==2.4.2
[pip3] optree==0.19.0
[pip3] torch==2.12.0a0+gitecbeb70
[conda] Could not collect
cc @ezyang @anjali411 @dylanbespalko @mruberry @nikitaved @amjames
Contributor guide
Assessment
This issue has not been assessed yet.