Repository: pytorch
Issue: RuntimeError: view_as_complex is only supported for half, float and double tensors, but got a tensor of scalar type: BFloat16
Labels: triaged,module: complex,module: bfloat16

### 🐛 Describe the bug

BFloat16 should support view_as_complex

```
In [4]: torch.view_as_complex(torch.rand(32,2))
Out[4]:
tensor([0.5686+0.0719j, 0.4356+0.3737j, 0.5070+0.0710j, 0.3190+0.9922j,
        0.0286+0.7838j, 0.3424+0.2291j, 0.6538+0.0426j, 0.7645+0.3523j,
        0.7656+0.2561j, 0.3005+0.6489j, 0.1265+0.3116j, 0.6779+0.5047j,
        0.7420+0.0151j, 0.5485+0.3000j, 0.5363+0.5574j, 0.8676+0.4026j,
        0.9972+0.7556j, 0.7337+0.4260j, 0.1703+0.0922j, 0.9353+0.2052j,
        0.1261+0.3311j, 0.1574+0.9259j, 0.9021+0.9478j, 0.4329+0.4403j,
        0.7340+0.8674j, 0.9771+0.0980j, 0.0575+0.2011j, 0.8210+0.5589j,
        0.3849+0.4482j, 0.2834+0.1872j, 0.7534+0.9229j, 0.4024+0.0708j])

In [5]: torch.view_as_complex(torch.rand(32,2).bfloat16())
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[5], line 1
----> 1 torch.view_as_complex(torch.rand(32,2).bfloat16())

RuntimeError: view_as_complex is only supported for half, float and double tensors, but got a tensor of scalar type: BFloat16
```

### Versions

PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 12.6 (arm64)
GCC version: Could not collect
Clang version: 14.0.0 (clang-1400.0.29.202)
CMake version: version 3.25.0
Libc version: N/A

Python version: 3.9.10 | packaged by conda-forge | (main, Feb  1 2022, 21:27:43)  [Clang 11.1.0 ] (64-bit runtime)
Python platform: macOS-12.6-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

Versions of relevant libraries:
[pip3] audiolm-pytorch==0.7.9
[pip3] ema-pytorch==0.1.4
[pip3] Mega-pytorch==0.0.12
[pip3] mypy==0.991
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.23.5
[pip3] pytorch-lightning==1.9.0
[pip3] torch==1.13.1
[pip3] torchaudio==0.13.1
[pip3] torchinfo==1.7.1
[pip3] torchmetrics==0.11.0
[pip3] torchview==0.2.5
[pip3] torchvision==0.14.1
[pip3] vector-quantize-pytorch==1.0.0
[conda] audiolm-pytorch           0.7.9                    pypi_0    pypi
[conda] ema-pytorch               0.1.4                    pypi_0    pypi
[conda] mega-pytorch              0.0.12                   pypi_0    pypi
[conda] numpy                     1.23.5                   pypi_0    pypi
[conda] numpy-base                1.21.5           py39hadd41eb_3
[conda] pytorch-lightning         1.9.0                    pypi_0    pypi
[conda] torch                     1.13.1                   pypi_0    pypi
[conda] torchaudio                0.13.1                   pypi_0    pypi
[conda] torchinfo                 1.7.1                    pypi_0    pypi
[conda] torchmetrics              0.11.0                   pypi_0    pypi
[conda] torchview                 0.2.5                    pypi_0    pypi
[conda] torchvision               0.14.1                   pypi_0    pypi
[conda] vector-quantize-pytorch   1.0.0                    pypi_0    pypi

cc @ezyang @anjali411 @dylanbespalko @mruberry @Lezcano @nikitaved