Repository: pytorch
Issue: torch.concat fails with float16 input in autocast(device_type=cpu) context
Labels: module: cpu,triaged,module: bfloat16,module: amp (automated mixed precision)

### 🐛 Describe the bug

`torch.concat` fails with half-float inputs in a `device_type="cpu"` context, which is quite surprising. It should just return a half-float output! The error is:

```
RuntimeError: Unexpected floating ScalarType in at::autocast::prioritize
```

```
with torch.autocast(device_type='cuda'):
    print(torch.concat([torch.zeros(size=(1, 1), dtype=torch.float32)]).dtype) # float32
    print(torch.concat([torch.zeros(size=(1, 1), dtype=torch.float16)]).dtype) # float16

with torch.autocast(device_type='cpu'):
    print(torch.concat([torch.zeros(size=(1, 1), dtype=torch.float32)]).dtype) # float32
    print(torch.concat([torch.zeros(size=(1, 1), dtype=torch.float16)]).dtype) # Fails!
```

### Versions

Collecting environment information...
PyTorch version: 2.0.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Rocky Linux release 8.5 (Green Obsidian) (x86_64)
GCC version: (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4)
Clang version: 12.0.1 (Red Hat 12.0.1-4.module+el8.5.0+715+58f51d49)
CMake version: version 3.20.2
Libc version: glibc-2.28

Python version: 3.11.3 | packaged by conda-forge | (main, Apr  6 2023, 08:57:19) [GCC 11.3.0] (64-bit runtime)
Python platform: Linux-4.18.0-348.20.1.el8_5.x86_64-x86_64-with-glibc2.28
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
Byte Order:          Little Endian
CPU(s):              48
On-line CPU(s) list: 0-47
Thread(s) per core:  1
Core(s) per socket:  1
Socket(s):           48
NUMA node(s):        6
Vendor ID:           AuthenticAMD
CPU family:          25
Model:               1
Model name:          AMD EPYC 75F3 32-Core Processor
Stepping:            1
CPU MHz:             2944.468
BogoMIPS:            5888.93
Hypervisor vendor:   VMware
Virtualization type: full
L1d cache:           32K
L1i cache:           32K
L2 cache:            512K
L3 cache:            32768K
NUMA node0 CPU(s):   0-7
NUMA node1 CPU(s):   8-15
NUMA node2 CPU(s):   16-23
NUMA node3 CPU(s):   24-31
NUMA node4 CPU(s):   32-39
NUMA node5 CPU(s):   40-47
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl tsc_reliable nonstop_tsc cpuid extd_apicid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext cpb invpcid_single ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves clzero wbnoinvd arat umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor

Versions of relevant libraries:
[pip3] numpy==1.24.3
[pip3] torch==2.0.0
[conda] mkl                       2022.2.1         h84fe81f_16997    conda-forge
[conda] numpy                     1.24.3          py311h64a7726_0    conda-forge
[conda] pytorch                   2.0.0           cpu_py311h410fd25_0    conda-forge


cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @mcarilli @ptrblck @leslie-fang-intel