Different behavior for complex numbers operations with numpy
Labels: triaged, module: complex, module: numpy, module: NaNs and Infs

### 🐛 Describe the bug

I am working with complex numbers and finding a different behavior between numpy and pytorch. When dividing by `0.0+0.0j` numpy produces `-inf+nanj ` and pytorch ` nan+nanj`. Afterward, I calculate the exponential, which in numpy evaluates to `0.0-0.0j` while pytorch propagates the nans. I am not sure what the correct behavior should be, but I think it is interesting to note the difference between the two packages. In my real code I add a small epsilon to the division to avoid the proliferation of nans, so this is not a real problem.

Here is the pytorch code

```python
import torch

x = torch.tensor([0.0+0.0j, 0.0+1.0j, 1.0+0.0j, 1.0+1.0j], requires_grad=True)
print(x)
l = -1.0/x
print(l)
s = torch.exp(l)
print(s)
loss = torch.mean(s)
print(loss)
loss.backward()
print(x.grad)
``` 
Output
```
tensor([0.+0.j, 0.+1.j, 1.+0.j, 1.+1.j], requires_grad=True)
tensor([    nan+nanj,  0.0000+1.0000j, -1.0000+0.0000j, -0.5000+0.5000j],
       grad_fn=<MulBackward0>)
tensor([   nan+nanj, 0.5403+0.8415j, 0.3679+0.0000j, 0.5323+0.2908j],
       grad_fn=<ExpBackward0>)
tensor(nan+nanj, grad_fn=<MeanBackward0>)
tensor([    nan+nanj, -0.1351+0.2104j,  0.0920-0.0000j,  0.0363+0.0665j])
```

And in numpy

```python
import numpy as np

x = np.asarray([0.0+0.0j, 0.0+1.0j, 1.0+0.0j, 1.0+1.0j])
print(x)
l = -1.0/x
print(l)
s = np.exp(l)
print(s)
loss = np.mean(s)
print(loss)
```
Output
```
[0.+0.j 0.+1.j 1.+0.j 1.+1.j]
[-inf+nanj  0. +1.j  -1. +0.j  -0.5+0.5j]
[0.        -0.j         0.54030231+0.84147098j 0.36787944+0.j
 0.53228073+0.29078629j]
(0.3601156193138132+0.2830643182551471j)
/tmp/ipykernel_6873/682756051.py:3: RuntimeWarning: divide by zero encountered in divide
  l = -1.0/x
/tmp/ipykernel_6873/682756051.py:3: RuntimeWarning: invalid value encountered in divide
  l = -1.0/x
```


### Versions

```
Collecting environment information...
PyTorch version: 1.13.0
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: CentOS Linux 7 (Core) (x86_64)
GCC version: (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Clang version: Could not collect
CMake version: version 2.8.12.2
Libc version: glibc-2.17

Python version: 3.10.8 (main, Nov  4 2022, 13:48:29) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-3.10.0-1160.76.1.el7.x86_64-x86_64-with-glibc2.17
Is CUDA available: True
CUDA runtime version: 10.1.243
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: 
GPU 0: Quadro RTX 8000
GPU 1: Quadro RTX 8000
GPU 2: Quadro RTX 8000
GPU 3: Quadro RTX 8000
GPU 4: Quadro RTX 8000
GPU 5: Quadro RTX 8000
GPU 6: Quadro RTX 8000

Nvidia driver version: 510.39.01
cuDNN version: /usr/lib64/libcudnn.so.7.6.5
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.4
[pip3] torch==1.13.0
[pip3] torchaudio==0.13.0
[pip3] torchvision==0.14.0
[conda] blas                      1.0                         mkl  
[conda] ffmpeg                    4.3                  hf484d3e_0    pytorch
[conda] mkl                       2021.4.0           h06a4308_640  
[conda] mkl-service               2.4.0           py310h7f8727e_0  
[conda] mkl_fft                   1.3.1           py310hd6ae3a3_0  
[conda] mkl_random                1.2.2           py310h00e6091_0  
[conda] numpy                     1.23.4          py310hd5efca6_0  
[conda] numpy-base                1.23.4          py310h8e6c178_0  
[conda] pytorch                   1.13.0          py3.10_cuda11.7_cudnn8.5.0_0    pytorch
[conda] pytorch-cuda              11.7                 h67b0de4_0    pytorch
[conda] pytorch-mutex             1.0                        cuda    pytorch
[conda] torchaudio                0.13.0              py310_cu117    pytorch
[conda] torchvision               0.14.0              py310_cu117    pytorch
```

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