Segmentation fault between Numpy and Pytorch using torch.bmm
Labels: oncall: binaries, module: crash, triaged

### 🐛 Describe the bug

When running the following script (taken from the torch.bmm documentation) in terminal:
```python
# test.py
import numpy as np
import torch

mat1 = torch.randn(10, 3, 4)
mat2 = torch.randn(10, 4, 5)
res = torch.bmm(mat1, mat2)
print(res.size())
```
The terminal returns
```
> python test.py
zsh: segmentation fault  python3 test.py
```
However, importing `torch` **before** `numpy` works as expected, and the terminal returns
```
> python test.py
torch.Size([10, 3, 5])
```
I am running on Python 3.9.16, Pytorch 1.13.1, and Numpy 1.21.2.

### 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 13.0.1 (x86_64)
GCC version: Could not collect
Clang version: 14.0.0 (clang-1400.0.29.202)
CMake version: Could not collect
Libc version: N/A

Python version: 3.9.16 (main, Jan 11 2023, 10:02:19)  [Clang 14.0.6 ] (64-bit runtime)
Python platform: macOS-10.16-x86_64-i386-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

Versions of relevant libraries:
[pip3] functorch==1.13.1
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.21.2
[pip3] pytorch-lightning==1.9.0
[pip3] torch==1.13.1
[pip3] torchaudio==0.10.1
[pip3] torchcde==0.2.5
[pip3] torchdiffeq==0.2.3
[pip3] torchdyn==1.0.3
[pip3] torchmetrics==0.11.0
[pip3] torchode==0.1.3
[pip3] torchsde==0.2.5
[pip3] torchtyping==0.1.4
[pip3] torchvision==0.11.2
[conda] blas                      1.0                         mkl  
[conda] functorch                 1.13.1                   pypi_0    pypi
[conda] mkl                       2021.4.0           hecd8cb5_637  
[conda] mkl-service               2.4.0            py39h9ed2024_0  
[conda] mkl_fft                   1.3.1            py39h4ab4a9b_0  
[conda] mkl_random                1.2.2            py39hb2f4e1b_0  
[conda] numpy                     1.21.2           py39h4b4dc7a_0  
[conda] numpy-base                1.21.2           py39he0bd621_0  
[conda] pytorch-lightning         1.9.0                    pypi_0    pypi
[conda] torch                     1.13.1                   pypi_0    pypi
[conda] torchaudio                0.10.1                 py39_cpu    pytorch
[conda] torchcde                  0.2.5                    pypi_0    pypi
[conda] torchdiffeq               0.2.3                    pypi_0    pypi
[conda] torchdyn                  1.0.3                     dev_0    <develop>
[conda] torchmetrics              0.11.0                   pypi_0    pypi
[conda] torchode                  0.1.3                    pypi_0    pypi
[conda] torchsde                  0.2.5                    pypi_0    pypi
[conda] torchtyping               0.1.4                    pypi_0    pypi
[conda] torchvision               0.11.2                 py39_cpu    pytorch

cc @ezyang @seemethere @malfet