Repository: pytorch
Issue: RuntimeError with operations on torch.float8_e5m2 and torch.float_e4m3fn data types
Labels: triaged,module: float8

### 🐛 Describe the bug

I've been experimenting with modifications in PyTorch ([this commit](https://github.com/pytorch/pytorch/pull/104242)) to support the torch.float8_e5m2 and torch.float_e4m3fn data types for CPU operations. While multiplication and division operations work as expected, I've encountered specific errors with addition and subtraction.

Steps to reproduce the behavior:

Create two random tensors using the following:
```python
a = torch.randn((2,3), dtype=torch.float8_e5m2)
b = torch.randn((2,3), dtype=torch.float8_e5m2)
```

The operations c = a * b and c = a / b execute without errors. However, when I attempt to use c = a + b or c = a - b, I encounter the error:
```
RuntimeError: "add_stub" not implemented for 'Float8_e5m2'
```
Additionally, if I use only a tensor with a single value for any operation, I receive the error:
```python
a = torch.tensor(1.2, dtype=torch.float8_e5m2)
b = torch.tensor(2.3, dtype=torch.float8_e5m2)
```
```
RuntimeError: Unsupported TypeMeta in ATen: nullptr (uninitialized)
```

Would appreciate guidance or a potential fix for these issues.

### Versions

Collecting environment information...
PyTorch version: 2.1.0a0+git89fd1b8
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.26.4
Libc version: glibc-2.35

Python version: 3.11.4 (main, Jul  5 2023, 13:45:01) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-76-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:                   46 bits physical, 48 bits virtual
Byte Order:                      Little Endian
CPU(s):                          48
On-line CPU(s) list:             0-47
Vendor ID:                       GenuineIntel
Model name:                      Intel(R) Xeon(R) CPU E5-2670 v3 @ 2.30GHz
CPU family:                      6
Model:                           63
Thread(s) per core:              2
Core(s) per socket:              12
Socket(s):                       2
Stepping:                        2
CPU max MHz:                     3100.0000
CPU min MHz:                     1200.0000
BogoMIPS:                        4589.34
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault epb invpcid_single pti intel_ppin ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm xsaveopt cqm_llc cqm_occup_llc dtherm ida arat pln pts md_clear flush_l1d
L1d cache:                       768 KiB (24 instances)
L1i cache:                       768 KiB (24 instances)
L2 cache:                        6 MiB (24 instances)
L3 cache:                        60 MiB (2 instances)
NUMA node(s):                    2
NUMA node0 CPU(s):               0-11,24-35
NUMA node1 CPU(s):               12-23,36-47
Vulnerability Itlb multihit:     KVM: Mitigation: VMX unsupported
Vulnerability L1tf:              Mitigation; PTE Inversion
Vulnerability Mds:               Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown:          Mitigation; PTI
Vulnerability Mmio stale data:   Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP conditional, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected

Versions of relevant libraries:
[pip3] numpy==1.25.2
[pip3] torch==2.1.0a0+git4bd5356
[conda] mkl                       2023.1.0         h213fc3f_46343
[conda] mkl-include               2023.1.0         h06a4308_46343
[conda] numpy                     1.25.2                   pypi_0    pypi
[conda] torch                     2.1.0a0+git4bd5356           dev_0    <develop>


cc @yanbing-j